Skip to content

Resetting Modal state on close #2609

Answered by TheSisb
hey-robin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @robnit,

Our Modal currently unmounts when closed, so form state should be cleared. Here's an example in Codesandbox: https://codesandbox.io/s/gallant-sutherland-1pebsd?file=/src/index.tsx

What I imagine could be happening for you is that your form state is defined in a parent component (like this example) which doesn't unmount and resets the initial value of the form elements on mount.

If this doesn't help solve your problem, could you create a minimal reproduction on Codesandbox please?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hey-robin
Comment options

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