How to do a route redirect in React component with react router 3 ?
If I user a 'guard' component like this:
const GuardContainer = (props) => {
const {ok} = isOk(props)
if (!ok) {
// Redirect here to /not-ok
return null
}
return <WrappedComponent {...props}/>
}
then React complains about changing state with
Cannot update during an existing state transition (such as within
renderor another component's constructor).