react router route component code example
Example 1: react router switch
ReactDOM.render((
<Switch>
<Route exact path="/" component={Home} />
<Route path="/login" component={Login} />
<Route path="/explore" component={Explore} />
</Switch>),
document.getElementById('root')
);
Example 2: route in component react
import { BrowserRouter, Route, Link } from "react-router-dom";