Skip to content

Need Help with maintaining FormTemplate State #1370

Answered by rvsia
ameyshr asked this question in Need help
Discussion options

You must be logged in to vote

Hello,

This happens because () => <FormTemplate name={name} /> is a component and on each re-render you re-initialize a new instance of it.

To solve this re-initialization, you can provide the component outside the form component and use context to share the value: https://codesandbox.io/s/data-driven-forms-example-forked-stdle1

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ameyshr
Comment options

@rvsia
Comment options

@ameyshr
Comment options

@Hyperkid123
Comment options

@ameyshr
Comment options

Answer selected by ameyshr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants