import React from "react";
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
export default function App() {
return (
{/* A looks through its children s and
renders the first one that matches the current URL. */}
);
}
function Home() {
return
Home
;
}
function About() {
return
About
;
}
function Users() {
return
Users
;
}
Example 4: react router install
npm install --save react-router-dom
Example 5: react router install
npm install --save react-router-dom
Example 6: react router install
// How to work with react router dom in react-web
import {
BrowserRouter as Router,
StaticRouter, // for server rendering
Route,
Link
// etc.
} from "react-router-dom";