Skip to content

Instantly share code, notes, and snippets.

@zhaoyao91
Created May 20, 2017 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhaoyao91/d3ea72bb0b5e6c0b4fd046a2354dbe00 to your computer and use it in GitHub Desktop.
Save zhaoyao91/d3ea72bb0b5e6c0b4fd046a2354dbe00 to your computer and use it in GitHub Desktop.
HOC to define a component which requires display name, prop types and being pure
import { setDisplayName, setPropTypes, pure, compose } from 'recompose'
export default function (displayName, propTypes = {}) {
return compose(
setDisplayName(displayName),
setPropTypes(propTypes),
pure
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment