2023-06-09

Troubleshooting Progress Bar Transition Issue in React Code

I’m having an issue with buggy code in my progress bar. The transition doesn’t start unless I wrap setStartTransition within setTimeout or requestAnimationFrame, as shown in this example: https://codesandbox.io/s/progress-bar-buggy-3pby7c?file=/src/progressBar.js. However, my understanding is that calling setStartTransition(true) after render should start the transition without the need for a timeout . fixed code : https://codesandbox.io/s/progress-bar-99nxwl?file=/src/progressBar.js. Can someone help me understand what’s happening? Is it an issue with setState?



No comments:

Post a Comment