-
Notifications
You must be signed in to change notification settings - Fork 237
comparison to use of "onEnter" #6
Comments
@tony-kerz the example you link using onEnter will not work when you want to check some information against a redux store, hence the reason for using the willMount/willReceive lifecycle method approach. React-Router is used in non-redux apps, so they dont offer up a way to take advantage of the store. The only other way I know of to access the store in onEnter is with this type of approach: https://github.com/CrocoDillon/universal-react-redux-boilerplate/blob/master/src/routes.jsx |
Hey @mjrussell I'm using |
onEnter works fine provided you have access to the store. Typically components in redux do not have an instance of the store except through the |
i had to use some closure trickery to have access to the store from the on-handler function, i'm also not thrilled about the flow around diverting from a protected route, |
I included a section on contrasting the onEnter approach with a Higher Order Component approach in the motivation section of my utility library for HOC auth - https://github.com/mjrussell/redux-auth-wrapper#motivation |
hi josh,
thanks for the example!
wondering if you can contrast your approach to that suggested by the rackt guys:
http://stackoverflow.com/a/32905508/2371903
https://github.com/rackt/react-router/tree/master/examples/auth-flow
best,
tony.
The text was updated successfully, but these errors were encountered: