how to work react router another component

Solutions on MaxInterview for how to work react router another component by the best coders in the world

showing results for - "how to work react router another component"
Agustina
08 Aug 2018
1import React, { Fragment } from "react";
2import "./index.css"
3
4import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
5
6export default function App() {
7  const name = 'John Doe'
8  const isAuthenticated = false
9  return (
10   <Router>
11    <main>
12      <nav>
13        <ul>
14          <li><Link to="/">Home</Link></li>
15          <li><Link to={`/about/${name}`}>About</Link></li>
16          <li><Link to="/contact">Contact</Link></li>
17        </ul>
18      </nav>
19    <Switch>
20      <Route path="/" exact component={Home} />
21      {
22      isAuthenticated ? 
23      <>
24      <Route path="/about/:name"  component={About} />
25      <Route path="/contact"  component={Contact} />
26      </> : <Redirect to="/" />
27      }
28      
29    </Switch>
30    </main>
31</Router>
32  );
33}
34
queries leading to this page
how to handle other routes in reactreact router to another pagehow to give a route from one component to another component in react functionhow to use a component inside another component in react routerhow to route from one component to another in reacthow do i handle routing in another component using reactreact route to another page in class componentreact routing another appreact other routersreact router to another componentreact route to another componentroute from one component to another reactreact routing to another page with propsanytime i access home route another is showingreact router from other componentreact router how i can go in other route inside others routesroute to another route react routerroute to another page from functional component reactreact route one articlehow to use a component inside another component in react routeroute to other component reacthow to give a route from one component to another component in reacthow do i handle routing in another component other then app js using reacthwo to use another component for react routerroute to another component reactdifferent routes on different pages react router domanother component from react router in react jsreact route to another component from compomentmake a component a link to another route react routrehow to call another router in reacthow to route another react app from one react appdisplay component in another route reactroute to a different page react routergoing one component to another component by react router linkrouter to another router react routerrouting from one component to another in react jscan i do routing in another component other then app js using reactreact router to different routereact transfer route to another componentnavigate to section on same page react router dom when routing to another page react renders the component inside reacthow to route to another component in reacthow to work react router another componentroute to another component in reactreact 2banother routehow to use react router to navigate to another componentroute to another page reacthow to work react router another component