1
ReactAdvanced#patterns#dom
A function that takes a component and returns an enhanced component, used to share cross-cutting behaviour. Hooks have largely replaced HOCs, but they still appear in older codebases and libraries.
function withAuth(Comp) {
return props => useAuth().user ? <Comp {...props} /> : <Login />;
}