This is my handle loggedIn. react-router v4
PrivateRoute is allow enter path if user is loggedIn and save the token to localStorge
function PrivateRoute({ component: Component, ...rest }) {
return (
(localStorage.token) ? : (
)
}
/>
);
}
Define all paths in your app in here
export default (
);