Created
June 16, 2017 08:26
-
-
Save srph/f28be87d71692ce2e3f66e38a8ca9d6a to your computer and use it in GitHub Desktop.
React: react-gateway context workaround (https://github.com/cloudflare/react-gateway/issues/4)
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
| class PassContext extends React.Component { | |
| getChildContext() { | |
| return { | |
| dragDropManager: this.props.dragDropManager | |
| }; | |
| } | |
| render() { | |
| return this.props.children; | |
| } | |
| } | |
| PassContext.childContextTypes = { | |
| dragDropManager: PropTypes.any | |
| } | |
| function X() { | |
| return ( | |
| <Gateway into="modal"> | |
| <PassContext dragDropManager={this.context.dragDropManager}> | |
| <Modal2>...</Modal2> | |
| </PassContext> | |
| </Gateway> | |
| ); | |
| } | |
| X.contextTypes = { | |
| dragDropManager: PropTypes.any | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment