Answer the question
In order to leave comments, you need to log in
Why does the state not change during testing after filling out the form?
Sandbox
I have an App component with a state of { isCardAdded: false }
.
If isCardAdded
false, the form is shown. The form consists of one field and a button.
If you fill out the form correctly, it isCardAdded
will become correct and the message "Card added" will be displayed.
I am testing a component.
Initially there was a problem that I was simulating events on other elements. So I rewrote the test with React-testing-library to dig into the right nodes.
Now I don’t understand why after filling out the form correctly, the message “Card added” is not displayed. Help me please.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question