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
In almost all of our stories which use useEffect, we are using it inside of a function embedded in JSX like this:
{()=>{useEffect(()=>{// ...},[]);}}
Storybook changed the number of times the function in JSX is called. Now useEffect gets called twice, even when we meant for it to be called once.
This is a problem for stories which might attach event listeners inside useEffect: we only want those listeners to get attached once, but they would get called multiple times.
We can fix this by moving the useEffect into a decorator:
In almost all of our stories which use
useEffect
, we are using it inside of a function embedded in JSX like this:Storybook changed the number of times the function in JSX is called. Now useEffect gets called twice, even when we meant for it to be called once.
This is a problem for stories which might attach event listeners inside useEffect: we only want those listeners to get attached once, but they would get called multiple times.
We can fix this by moving the useEffect into a decorator:
To see an example of this change, see #1918
The text was updated successfully, but these errors were encountered: