score:0

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

score:1

import React from "react";
import {
  BrowserRouter,
  Route,
  Switch,
  NavLink,
  Redirect
} from "react-router-dom";

class App extends React.Component {
  render() {
    return (
      <BrowserRouter>
        <Authenticate />
        <Switch>
          <Route path="/" exact component={Login} />
          <Route path="/Login" component={Login} />
          <Route path="/Register" component={Register} />
          <Route path="/AppHome" component={AppHome} />
        </Switch>
      </BrowserRouter>
    );
  }
}

const Login = () => (
  <div>
    Login Content <NavLink to="/AppHome"> go to App</NavLink>
  </div>
);

const Register = () => <div> Register Content </div>;

const AppHome = () => <div> Welcome to the App </div>;

class Authenticate extends React.Component {
  render() {
    return (
      <>
        <div>
          <NavLink to={"/Login"}> Login </NavLink>
          <NavLink to={"/Register"}> Register </NavLink>
        </div>
      </>
    );
  }
}

export default App;

Related Query

More Query from same tag