TanStackT
TanStack2y ago
9 replies
living-lavender

Getting multiple re-renders

When I load the app, and when my routes change, my Root Route seems to re-render.

Im generating the logs using the useLogRenders hook from this example from an issue I saw on github which could be a similar problem?

In the logs screenshot, I've got no react components being rendered in my Root route.

const Root = () => {
  useLogRenders('Root');
  return (
    <></>
  );
};

export const rootRoute = createRootRouteWithContext<AppContext>()({
  validateSearch: appSearchParamsSchema,
  component: Root,
})


https://stackblitz.com/edit/tanstack-router-bxtshb?file=src/routes/__root.tsx
image.png
StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
Router Basic File Based Example (forked) - StackBlitz
Was this page helpful?