react-kilto
Version:
Bindings between Kilto and React
39 lines (33 loc) • 849 B
JavaScript
import { Component, PropTypes } from 'react';
export default class Provider extends Component {
constructor(props) {
super(props);
this.store = props.store;
}
getChildContext() {
return {
store: this.store
};
}
render() {
return this.props.children;
}
}
Provider.displayName = 'Provider';
Provider.propTypes = {
children: PropTypes.node.isRequired,
store: PropTypes.shape({
getState: PropTypes.func.isRequired,
subscribe: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired
}).isRequired
};
Provider.childContextTypes = {
store: PropTypes.shape({
getState: PropTypes.func.isRequired,
subscribe: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired
}).isRequired
};