react-transition-group icon indicating copy to clipboard operation
react-transition-group copied to clipboard

Unexpected behavior while working with useState

Open arkni8 opened this issue 1 year ago • 0 comments

What is the current behavior?

Currently, I am seeing no updating of state. When I am trying to update a useState variable - the variable just fails to update. It could possibly be because using SwitchTransition component somehow changes the block scope. Not sure how, and I could be wrong but that's what I am thinking.

What is the expected behavior?

Expected behavior - Change the useState variable as I want it to. You will see, if you comment out the SwitchTransition component from App.js file - everything starts working as expected. The entry animations will play when you press Next. The useState variable updates properly. But as soon as you insert SwitchTransition back - the component stops updating.

Bonus problem/guidance needed - How can I make the exit animation work?

Could you provide a CodeSandbox demo reproducing the bug?

Why, yes. Absolutely. Codesandbox link here

arkni8 avatar Apr 30 '23 14:04 arkni8