Better demonstration than most on this topic... It's important to understand how to compose higher level components from lower-level ones.. in the case of the simple redirect component wrappers, they could very well be static functions with the dispatch action inside the render function...
// require-auth.js
export default (redirectTo, component) => (props, context) => {
const {user} = context.store.getState();
if (user) return component;
setTimeout(() => context.store.dispatch(push(redirectTo)), 0);
return null;
}
Having a defered dispatch method would make it a bit easier, in any case, it can be simpler still...
Just the same, very nice article.