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
{{ message }}
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
constroutes={'/:id*': ({ id })=>props=><MyComponent{...props}id={id}/>};constApp=(props)=>{constres=useAPI();constmatch=useRoutes(routes);if(!match)return'Page not found';return(<ErrorBoundary>{match({ ...props, ...res})}</ErrorBoundary>);};
MyComponent should render and should take in props and the res of the api. It does do this, but it also unmounts and remounts with every render of App. When the useAPI updates its inner state and causes a rerender, the MyComponent remounts.
It seems like useRoutes does not memoize the reference to any function or object it creates and thus recreates them even if the route does not change
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following does render and accurately routes
MyComponent should render and should take in props and the res of the api. It does do this, but it also unmounts and remounts with every render of App. When the useAPI updates its inner state and causes a rerender, the MyComponent remounts.
It seems like useRoutes does not memoize the reference to any function or object it creates and thus recreates them even if the route does not change
The text was updated successfully, but these errors were encountered: