React Router v7 需要以下最低版本
node@20
react@18
react-dom@18
大多数项目从模板开始。让我们使用 React Router 维护的基本模板
npx create-react-router@latest my-react-router-app
现在进入新目录并启动应用
cd my-react-router-app
npm i
npm run dev
现在你可以打开浏览器访问 https://127.0.0.1:5173
你可以 在 GitHub 上查看模板,了解如何手动设置你的项目。
我们还有许多 可部署的模板 供你入门
npx create-react-router@latest --template remix-run/react-router-templates/<template-name>
下一步:路由