From the documentation of Atlassian Forge for Confluence, I am trying this to have a form with a value that can be set. Snippets:
const [formState, setFormState] = useState( {depth: -1});
const onSubmit = async (formData) => {
setFormState( formData);
}
<Form onSubmit={onSubmit}><TextField label="Show depth" name="depth" type="number" defaultValue={formState.depth}/></Form>
My useState()
sets the default value to "-1" on each render. But I would like to have the component remember what I have set from page render to page re-render. Form submits work fine. Submit a new value and setDepth triggers a re-render. But reload the page and I have to start all over again.
I've looked at useContentProperty()
but did not get it to work.
What am I missing?