Does anyone know how to restrict access to particular routes in react-router? I want to check if the user is logged in before allowing access to a particular route. I thought it would be simple, but the docs aren't clear how to do it.
Is this something I should set up where I define my <Route>
components, or should I be handling it inside my component handlers?
<Route handler={App} path=/>
<NotFoundRoute handler={NotFound} name=not-found/>
<DefaultRoute handler={Login} name=login/>
<Route handler={Todos} name=todos/> {/* I want this to be restricted */}
</Route>