DEV Community

Discussion on: You don't have to use Redux

Collapse
 
patroza profile image
Patrick Roza • Edited

Would suggest to use useContext, either directly, or in the HOC:

const withUser = (Component) =>
  (props) => {
    const user = useContext(UserContext)
    return <Component {...props} user={user} />
  }
Collapse
 
jack profile image
Jack Williams

Yep you sure could! The original example was without hooks, so I went that route.