<Switch>
<Route exact path="/" component={Home}/>
<Route path="/nobel-laureates" component={About}/>
<Route path="/usage-statistics" component={History}/>
<Route component={PageNotFound}/>
</Switch>
import React, { Component } from 'react';
import { Redirect } from 'react-router-dom';
const isVisited = localStorage.getItem("isVisited");
if (!isVisited) {
localStorage.setItem("isVisited", true);
}
class Home extends Component {
...
render() {
if (!isVisited) return <Redirect to="/nobel-laureates" />
...
}
}