From 7ee6396cb6aab3aa85c76cf511e85579e6e989e6 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 9 Oct 2017 13:27:24 +0900 Subject: [PATCH] Add Provider component --- src/shared/store/provider.jsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/shared/store/provider.jsx diff --git a/src/shared/store/provider.jsx b/src/shared/store/provider.jsx new file mode 100644 index 0000000..743f656 --- /dev/null +++ b/src/shared/store/provider.jsx @@ -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;