xreact-add-react-router
v5.5.3
Published
Add React Router setup to an existing React app (auto-detects TypeScript).
Maintainers
Readme
xreact-add-react-router
Add React Router setup to an existing React app. Automatically detects TypeScript via tsconfig.json.
Quick Start
npx xreact-add-react-router@latestAlternatives
- Install globally, then run:
npm i -g xreact-add-react-router
xreact-add-react-router- Add as a project script:
npm pkg set scripts.add-router="xreact-add-react-router"
npm run add-routerWhat it does
- Installs
react-router-dom - Creates
src/navigationwithindexandroutes - Adds
pages/login,pages/home, and a basiccomponents/layout/MainLayout - Updates
src/App.tsx/src/App.jsxto use the router
Requirements
- Run it from your app root (where
package.jsonlives) - TypeScript is detected via
tsconfig.json; otherwise JavaScript is assumed
After running
npm run dev