Replies: 1 comment
-
I got this working with the useFormsFields hook but this should also work with useAllFormFields. Type definition is just a simple mockup for now. type TextNode = [{[x: string]: unknown; text: string; children?: TextNode; type?: string}];
const [value, setValue]: [TextNode, (value: TextNode) => void] = useFormFields(([fields, dispatch]) => [
fields[path].initialValue as TextNode,
(value: TextNode) => dispatch({type: "UPDATE", path: path, initialValue: value}),
]); With string fields, you can use the value property, with the richText field (SlateJS editor), take the initialValue property. Otherwise the editor content won't rerender. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to update the value from slateEditor from another component event. I find out that I can update value of some simple component like Checkbox, Text, TextArea with
dispatch
Update but not for SlateEditor. Any suggestions on it?Beta Was this translation helpful? Give feedback.
All reactions