Created
October 27, 2020 03:04
-
-
Save mjhassan/aebd9111182b7831cac9af2d144cf934 to your computer and use it in GitHub Desktop.
Hook usage in class
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
| function withHook(Component) { | |
| return function WrappedComponent(props) { | |
| const useReducer = React.useReducer(reducer, initialState); | |
| return <Component {...props} useReducer={useReducer}/> | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment