Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

HOC for use with non hook components #49

Open
RedHatter opened this issue Feb 28, 2019 · 1 comment
Open

HOC for use with non hook components #49

RedHatter opened this issue Feb 28, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@RedHatter
Copy link

Having a code base that has both hook based and class based components is common. It would be useful for react-atom to provide a HOC for these components. Something simple like the following should work.

const connect = (mapStateToProps, store) => Component => props => {
  const stateProps = mapStateToProps(useAtom(store))
  return <Component {...stateProps} {...props} />
}
@derrickbeining
Copy link
Owner

@RedHatter , I'm not opposed to that. Feel free to make a PR if you like. I need to add a contributing doc, but in short: please include tests and use npm run git:commit when ready to commit.

Otherwise, I'll get around to this when I have time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants