How does this example from React documentation work?
Hello guys, I'm reading the new React documentation but I don't understand a little thing. In the step 5 in this page https://react.dev/learn/reacting-to-input-with-state the
I tried to add a new
handleSubmit function updates the status state 2 times (one at the top level and one inside try/catch). How is that possible? Shouldn't state be updated with just the last value?I tried to add a new
counter state and increment it by 1 every time that setStatus is called, and it actually gets incremented only by one per submit, as I expected... so why is setStatus different?
