Steps to set up React project with React Router
Step 1: Create a react project folder, open the terminal, and write the following command.
# Run this to use npm
npx create-react-app foldername
# Or run this to use yarn
yarn create react-app foldername
Step 2: Navigate to the root directory of your project using the following command.
cd foldername
Step 3: Now, install the React Router library
npm install react-router-dom
or
yarn add react-router-dom
Explain Nested Routes in React
Nested Routes are a type of routing in which one route is linked to another route. To set up routing on the client side in the React project and to enable navigation in our project, we will use the React Router library. React Router is a powerful library that helps in creating single-page applications (SPAs). In this article, we will be creating some routes of an e-commerce app to understand nested routes properly. So first of all let’s set up our react project and prepare the project’s basic UI.
Contact Us