@fwnanodev/cra-template-router
This @fwnanodev/cra-template-router template is based off cra-template that has react-router-dom v6 set up already with 5 pre-routed pages plus a Layout.jsx. It is mainly used for our Azure static web app creation script. You can find it in npmjs package feed.
It is also configured to work with Azure Static Webapps.
Usage
You can use it by specifying:
npx create-react-app my-custom-template-project --template @fwnanodev/router
Configuration
Once the project is built, you can customize the component names. To rename RootComponent into Home:
- Rename
/pages/RootComponent/RootComponent.jsx
to/pages/Home/Home.jsx
- Inside the newly renamed
Home.jsx
, changeRootComponent
toHome
- Then in
route-constants.js
, renameROOT_COMPONENT_NAME
toHOME_COMPONENT_NAME
andROOT_COMPONENT_ROUTE
toHOME_COMPONENT_ROUTE
After the components are renamed to your liking, you can begin adding your custom react code as normal.
Additional Information
For more information, you can always refer to the create-react-app documentation:
- Getting Started – How to create a new app.
- User Guide – How to develop apps bootstrapped with Create React App.