router dom react
npm install react-router-dom
react router dom
npm install react-router-dom
//This will Install the react-router to the required folder
//Here is a Sample Code for React Router DOM
import React from "react";
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
export default function App() {
return (
<Router>
<div>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
<li>
<Link to="/users">Users</Link>
</li>
</ul>
</nav>
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route exact path="/about">
<About />
</Route>
<Route exact path="/users">
<Users />
</Route>
<Route exact path="/">
<Home />
</Route>
</Switch>
</div>
</Router>
);
}
react router dom
import React from "react";
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
export default function App() {
return (
<Router>
<div>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
<li>
<Link to="/users">Users</Link>
</li>
</ul>
</nav>
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route path="/about">
<About />
</Route>
<Route path="/users">
<Users />
</Route>
<Route path="/">
<Home />
</Route>
</Switch>
</div>
</Router>
);
}
function Home() {
return <h2>Home</h2>;
}
function About() {
return <h2>About</h2>;
}
function Users() {
return <h2>Users</h2>;
}
react router dom
npm install react-router-dom
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
react router dom
import { BrowserRouter as Router, Switch, Route, Link} from "react-router-dom";
<Router>
<Switch>
<Route path="/" />
</Switch>
</Router>
router components in react
import { BrowserRouter, Route, Link } from "react-router-dom";
<Router>
<Route component={Navbar} />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/login" component={Login} />
<Route
exact
path="/email-verify"
component={() => <EmailVerification token={TokenValue} />}
/>
<Route component={() => <h3 className="text-center">Error 404</h3>} />
</Switch>
</Router>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us