Cannot update a component (Router) while rendering a different component - TanStack