I want to create an auth HOC that will redirect the user or show the component.
ie:
const AuthExtender = props => {
if (!props.logged) return <Redirect to="/login" />;
return <WrappedComponent />;
}
const authCompWithState = connect(state=>({logged:state.logged}))(AuthExtender);
I know this is not right, but this is the idea I want to have:
const MembersPageForLoggedOnly = memberOnlyPageHOC(MemebersPage);
I tried so many version of a function that returns function, but I can't nail it...
Any ideas?
Thanks!