Created
September 13, 2017 23:15
-
-
Save lewisf/43b365256c796257ee246b530912a354 to your computer and use it in GitHub Desktop.
How SSR Works in React Apollo Code Example 7
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 asyncAction(dispatchFn) { | |
| return function(Component) { | |
| class AsyncAction extends React.Component { | |
| static displayName = `Action(${Component.displayName})` | |
| fetchData() { | |
| return dispatchFn(props, dispatch); | |
| } | |
| render() { | |
| return <Component {...this.props} /> | |
| } | |
| } | |
| hoistNonReactStatics(Component, AsyncActionComponent); | |
| return AsyncActionComponent; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment