Create routes in react app for first time



It's pretty simple to get started with routing in react. You just have to use react-router-dom.
1. Install react-router-dom , using command
npm i react-router-dom2. After installation go to your App.js or index.js file and import the following from react-router-dom
import { BrowserRouter, Route, Routes } from"react-router-dom";
After this go to your app or main function and call your routes like this
<BrowserRouter>
<Routes>
<Route path="/" element={<Home/>} />
</Routes>
</BrowserRouter>
And import the pages from the rest file for eg. in my case
import Home from "./screens/home";
Thats it!!


