<Router>
<div>
<PrivateRoute path="/" auth={Math.random() > Math.random()} redirect={"/login"} component={loadable(() => import("./pages/home"))} />
<Route exact path="/login" component={loadable(() => import("./pages/login"))} />
</div>
</Router>
Astrocoders/react-router-private-route
Too lazy to rewrite it all the time, so here it is - simple private route(might or might not be based on https://reacttraining.com/react-router/web/example/auth-workflow)
JavaScriptMIT