Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Created June 19, 2021 20:06
Show Gist options
  • Save sabesansathananthan/6235bd8b3c1fcaf21a0b10e38e51bbf3 to your computer and use it in GitHub Desktop.
Save sabesansathananthan/6235bd8b3c1fcaf21a0b10e38e51bbf3 to your computer and use it in GitHub Desktop.
How React Components Are Reused
// React Redux's `connect` Function
const ConnectedComment = connect(commentSelector, commentActions)(CommentList);
// connect is a function, and its return value is another function.
const enhance = connect(commentListSelector, commentListActions);
// The return value is HOC, which will return components that have been connected to the Redux store
const ConnectedComment = enhance(CommentList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment