Skip to content

Instantly share code, notes, and snippets.

@srph
Created June 16, 2017 08:26
Show Gist options
  • Select an option

  • Save srph/f28be87d71692ce2e3f66e38a8ca9d6a to your computer and use it in GitHub Desktop.

Select an option

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)
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