Skip to content

Model initialization on re-render #1025

Answered by wadamek65
mdesousa asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mdesousa ,

onSubmit triggers renders due to the fact that it's setting the submitting state, but that should not be causing the behavior that you have described.

Your example of code may suggest that this happens due to the change of model variable in the component's body which you generally would want to avoid or keep a stable reference to it (wrap in a useMemo for example). Would you mind expanding your sample of code or creating a reproduction in a CodeSandbox?

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@radekmie
Comment options

@mdesousa
Comment options

@radekmie
Comment options

@mdesousa
Comment options

@radekmie
Comment options

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