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
Repeated renders of a component using useLocation return new instances of setContext and setLocation. This makes it very dangerous to use this functions as they can easily trigger re-renders if you are not careful.
The setContext has been wrapped in a useEffect to prevent continuous triggering of setContext to retrigger full <Routes /> re-render. This fails because the effect is relaunched on every render since setContext changes to a new pointer on each render.
To prevent this, setContext and other router callbacks should be a stable ref.
The text was updated successfully, but these errors were encountered:
Repeated renders of a component using
useLocation
return new instances ofsetContext
andsetLocation
. This makes it very dangerous to use this functions as they can easily trigger re-renders if you are not careful.See for example this code:
The
setContext
has been wrapped in auseEffect
to prevent continuous triggering ofsetContext
to retrigger full<Routes />
re-render. This fails because the effect is relaunched on every render sincesetContext
changes to a new pointer on each render.To prevent this,
setContext
and other router callbacks should be a stable ref.The text was updated successfully, but these errors were encountered: