Skip to content

Instantly share code, notes, and snippets.

@manoelneto
Created August 7, 2018 21:46
Show Gist options
  • Select an option

  • Save manoelneto/3fe1fa7330ef70186811a021df4b3318 to your computer and use it in GitHub Desktop.

Select an option

Save manoelneto/3fe1fa7330ef70186811a021df4b3318 to your computer and use it in GitHub Desktop.
withRouter.js
export default const withRouter = (OriginalComponent) => {
class NewComponent extends Component {
state = {
router: initialRouter
}
anotherFunc = () => {
...
}
render() {
<OriginalComponent {...this.props} router={this.state.router} anotherFunc={this.anotherFunc} />
}
}
return NewComponent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment