Created
December 17, 2017 12:45
-
-
Save bbandydd/57445fe46b649cd1d3f735a3e150a126 to your computer and use it in GitHub Desktop.
HOC-disadvantage1
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
| // without {...this.props} | |
| const HOC = (WrappedComponent) => { | |
| return class extends Component { | |
| render() { | |
| return ( | |
| <WrappedComponent /> | |
| ) | |
| } | |
| } | |
| } | |
| // should be | |
| const HOC = (WrappedComponent) => { | |
| return class extends Component { | |
| render() { | |
| return ( | |
| <WrappedComponent {...this.props}/> | |
| ) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment