Last active
September 20, 2017 00:26
-
-
Save alexkrolick/e38eec70130390b23bf54baaa78368bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // JSX | |
| const withFooProp = WrappedComponent => props => <WrappedComponent foo={2} {...props} /> | |
| // createElement | |
| const withFooProp = WrappedComponent => props => h(WrappedComponent, { foo: 2, ...props }) | |
| const Bar // ... a component | |
| export default withFooProp(Bar) // export an augmented version of Bar | |
| // elsewhere... | |
| import Bar from './bar' | |
| // props {baz: 2, foo: 2} | |
| <Bar baz={2} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment