Skip to content

Instantly share code, notes, and snippets.

@lewisf
Created September 13, 2017 23:15
Show Gist options
  • Select an option

  • Save lewisf/43b365256c796257ee246b530912a354 to your computer and use it in GitHub Desktop.

Select an option

Save lewisf/43b365256c796257ee246b530912a354 to your computer and use it in GitHub Desktop.
How SSR Works in React Apollo Code Example 7
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