Hi,
I am in process of developing one custom experience builder where it will have four user parameter for that I am using dropdowns. Functionality is working fine, but when user click the button F5 or refresh the page I am not able to see the parameter set by the user , the controls are resetted.
Please let me how to maintain the control state.
Solved! Go to Solution.
Hi,
Please use "props" property to hold the values and in "Useeffect" to populate the values back to dropdown even when user refresh the page.
useEffect(() => {
selectedLayerIdRef.current = props.config.selectedLayerId;
selectedFieldRef.current = props.config.selectedField;
acquisitionDateFieldRef.current = props.config.selectedDateField;
cameraHeadingFieldRef.current = props.config.selectedCameraHeadingField;
showArrowRef.current = props.config.showArrow;
showCompassRef.current = props.config.showCompass ?? false;
}, [props.config.selectedLayerId, props.config.selectedField, props.config.selectedDateField, props.config.selectedCameraHeadingField, props.config.showArrow, props.config.showCompass]);
Hi,
Please use "props" property to hold the values and in "Useeffect" to populate the values back to dropdown even when user refresh the page.
useEffect(() => {
selectedLayerIdRef.current = props.config.selectedLayerId;
selectedFieldRef.current = props.config.selectedField;
acquisitionDateFieldRef.current = props.config.selectedDateField;
cameraHeadingFieldRef.current = props.config.selectedCameraHeadingField;
showArrowRef.current = props.config.showArrow;
showCompassRef.current = props.config.showCompass ?? false;
}, [props.config.selectedLayerId, props.config.selectedField, props.config.selectedDateField, props.config.selectedCameraHeadingField, props.config.showArrow, props.config.showCompass]);