You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code will cause an infinite loop. The effect hook will fail to update the lastValues, because of the error stopping the execution of call. This means that on the next render, the effect will run again, even though the deps array is still [], thus scheduling another update, causing the infinite loop.
functionApp(){const[state,setState]=useState(0);useEffect(()=>{// an update is scheduledsetState((state)=>state!+1);// an error is thrownthrownewError("Unexpected error");},[]);returnstate;}
I will submit a potential fix momentarily.
The text was updated successfully, but these errors were encountered:
This code will cause an infinite loop. The effect hook will fail to update the
lastValues
, because of the error stopping the execution ofcall
. This means that on the next render, the effect will run again, even though the deps array is still[]
, thus scheduling another update, causing the infinite loop.I will submit a potential fix momentarily.
The text was updated successfully, but these errors were encountered: