react-router-condition
npm i --save react-router-condition
import { ConditionRedirectRoute as Route } from "react-router-condition";
<Route path="/setting" condition={checkAuth()} component={Setting} redirectURL="/" />
import { ConditionComponentRoute as Route } from "react-router-condition";
<Route path="/setting" condition={checkAuth()} component={Setting} failComponent={Login} />
import { PrivateRoute } from "react-router-condition";
<PrivateRoute condition={checkAuth()} redirectURL="/">
<Route path="/setting" Compontent={Setting} />
<Route path="/profile" Compontent={Profile} />
<PrivateRoute />
import { PrivateRoute } from "react-router-condition";
<PrivateRoute condition={checkAuth()} redirect={Login}>
<Route path="/setting" Compontent={Setting} />
<Route path="/profile" Compontent={Profile} />
<PrivateRoute />
hi