Answers for "react router-dom example"

30

npm react router dom

$ npm install --save react-router-dom
Posted by: Guest on June-13-2020
1

starting with 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>
Posted by: Guest on May-28-2020

Browse Popular Code Answers by Language