Created
October 31, 2016 12:21
-
-
Save benjdlambert/668fa683a03ea14a49199681e22d34e5 to your computer and use it in GitHub Desktop.
This file contains 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 createContainer(ReactClass, options) { | |
return class Container extends React.Component { | |
setDataParams(dataParams) { | |
this.setState({ dataParams }) | |
} | |
render() { | |
return <ReactClass setDataParams={this.setDataParams} /> | |
} | |
} | |
} | |
class Component extends React.Component { | |
onScroll() { | |
this.props.setDataParams({ page: '1' }) | |
} | |
render() { | |
<div>Current page {this.props.page.body.id} | |
} | |
} | |
export default createContainer( | |
Component, { | |
data(props, dataParams) { | |
return { | |
page: `/${dataParams.page}` | |
} | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment