Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Created August 13, 2018 16:43
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 shawnbot/bda54c202f20ea431f82b50b21e5b776 to your computer and use it in GitHub Desktop.
Save shawnbot/bda54c202f20ea431f82b50b21e5b776 to your computer and use it in GitHub Desktop.
export default function extend(Component, extensions = {}) {
const {fixedProps, ...otherExtensions} = extensions
const Extended = fixedProps
? props => <Component {...props} {...fixedProps} />
: props => <Component {...props} />
return Object.assign(Extended, Component, otherExtensions)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment