Created
March 22, 2018 20:21
-
-
Save sarjumulmi/ee269f04eb7ba9d71ccc5fd30127821c to your computer and use it in GitHub Desktop.
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
import React, {Component} from "react"; | |
import PropTypes from "prop-types"; | |
export default class Provider extends Component { | |
const {dispatch, subscribe, getState} = this.props.store; | |
getChildContext(){ | |
return {dispatch, subscribe, getState}; | |
} | |
return ( | |
<div>{this.props.children}</div> | |
) | |
} | |
Provider.propTypes = { | |
children: PropTypes.any, | |
store: PropTypes.shape({ | |
dispatch: PropTypes.func, | |
subscribe: : PropTypes.func, | |
getState: : PropTypes.func | |
}) | |
} | |
Provider.childContextTypes = { | |
dispatch: PropTypes.func, | |
subscribe: : PropTypes.func, | |
getState: : PropTypes.func | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment