#React Router 7 - Disconnect between documentation and default project routing

1 messages · Page 1 of 1 (latest)

tranquil umbra
#

I'm a bit confused about the routing docs vs. the actual codebase. When starting a new project, I see this in the routes file:

import { type RouteConfig, index } from "@react-router/dev/routes";
export default [index("routes/home.tsx")] satisfies RouteConfig;

However, the docs show a completely different approach using <Routes>, <Route>, and <BrowserRouter> components. The examples in the docs don't match what's in the default app structure at all.

Questions:
Why is there such a big difference between the docs and the default codebase?
Which approach should I be following as a beginner?
Is there documentation that better aligns with the new index() based routing?

Would really appreciate some guidance on the best learning path here! Thanks in advance.

thin onyx
#

How do you start new projects? Using create-react-app? I don't know much about this, except that this tool is sort of unofficially deprecated. In one of the top#1006307992322453564 threads, there's more on this topic.