Is router.tsx a magic file ? Is it hardcoded on Tanstack router ?
Is
src/router.tsx treated as a special file ?
In the Authenticated Routes example, there is no router.tsx, only a main.tsx
https://tanstack.com/router/latest/docs/framework/react/examples/authenticated-routes?panel=code
But when I try to use only the main.tsx file, the app breaks with a very obscure message
React TanStack Router Authenticated Routes Example | TanStack Route...
An example showing how to implement Authenticated Routes in React using TanStack Router.
4 Replies
flat-fuchsiaOP•5d ago
Yeah looks like Tanstack is not using the
main.tsx file at all
So I can't inject the AuthProvider
How do I solve ?
Looks like the AuthenticatedRoutes example is outdatedharsh-harlequin•5d ago
are you using start or router?
if start, please use #start-questions and check the start docs
flat-fuchsiaOP•5d ago
Thank you, but I can't use Tanstack Router docs on Tanstack Start apps ?
I thought it used Tanstack Router without changes
I didn't see any big red notices on the Start docs warning me against reading Router docs
that's confusing
flat-fuchsiaOP•5d ago
This Start docs page:
https://tanstack.com/start/latest/docs/framework/react/guide/authentication-overview#examples
Under "Client-Side Examples: -> Basic Authentication", it links to
https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes
which has a
main.tsx and not a router.tsx
It should work, but the error message doesn't tell me why it doesn'tGitHub
router/examples/react/authenticated-routes at main · TanStack/router
🤖 A client-first, server-capable, fully type-safe router and full-stack framework for the web (React and more). - TanStack/router
Authentication | TanStack Start React Docs
Authentication vs Authorization Authentication: Who is this user? (Login/logout, identity verification) Authorization: What can this user do? (Permissions, roles, access control) Architecture Overview...