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
I think this should be some constant emptyObj reuse instead of made anew because it causes rerenders.
I'm also seeing truthy a routeMatch give an identical object over and over but I was under the impression that this was fixed in v6 with #7059 and #8431.
Actual Behavior
returns a new {} every time.
or when routeMatch is truthy, unnecessary rerenders with something like { "*": "" } as the return value.
The text was updated successfully, but these errors were encountered:
You shouldn't be using the entire result of useParams in your dependencies for React hooks. If you navigate and don't change the params values, you'll have the same problem as the object will still be recreated. Instead, you should check specific params that you care about. That will ensure you don't re-render when it's not needed, regardless of what the state of params is.
What version of React Router are you using?
6
Steps to Reproduce
react-router/packages/react-router/lib/hooks.tsx
Line 236 in 38359a9
Expected Behavior
I think this should be some constant emptyObj reuse instead of made anew because it causes rerenders.
I'm also seeing truthy a
routeMatch
give an identical object over and over but I was under the impression that this was fixed in v6 with #7059 and #8431.Actual Behavior
returns a new
{}
every time.or when
routeMatch
is truthy, unnecessary rerenders with something like{ "*": "" }
as the return value.The text was updated successfully, but these errors were encountered: