<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>
rokasmuningis / react-router-private-route Goto Github PK
View Code? Open in Web Editor NEWToo 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)
License: MIT License