Installing the React Router Framework
For this section of the tutorial, in addition to React Router, we will be using Vite as a builder and test server.
First, let's create a React app my-app using Vite. To do this, open the terminal and enter the following commands:
npm create vite@latest my-app -- --template react
cd my-app
npm install
In order to work with routing we need the react-router-dom module, let's install it too:
npm install react-router-dom
Now everything is ready to start working. Let's launch our application:
npm run dev
Copy the link http://localhost:5173/, specified in the terminal, to the browser address bar and see the running application (you can press the button with the counter).
Create an app in React with Vite as described in the tutorial, install the react-router-dom module. Make sure the app runs.