I have the following structure:
FormEditor
– holds multiple instances of FieldEditor
FieldEditor
– edits a field of the form and saving various values about it in its state
When a button is clicked within FormEditor, I want to be able to collect information about the fields from all FieldEditor
components, information that’s in their state, and have it all within FormEditor.
I considered storing the information about the fields outside of FieldEditor
‘s state and put it in FormEditor
‘s state instead. However, that would require FormEditor
to listen to each of its FieldEditor
components as they change and store their information in its state.
Can’t I just access the children’s state instead? Is it ideal?