Add Provider component
This commit is contained in:
parent
1a7632e353
commit
7ee6396cb6
1 changed files with 18 additions and 0 deletions
18
src/shared/store/provider.jsx
Normal file
18
src/shared/store/provider.jsx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
class Provider extends React.PureComponent {
|
||||||
|
getChildContext() {
|
||||||
|
return { store: this.props.store };
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return React.Children.only(this.props.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Provider.childContextTypes = {
|
||||||
|
store: PropTypes.any,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Provider;
|
Reference in a new issue