diff --git a/src/components/createConnect.js b/src/components/createConnect.js index fc0be32e0..c0f6f4164 100644 --- a/src/components/createConnect.js +++ b/src/components/createConnect.js @@ -78,16 +78,6 @@ export default function createConnect(React) { return function wrapWithConnect(WrappedComponent) { class Connect extends Component { - static displayName = `Connect(${getDisplayName(WrappedComponent)})`; - static WrappedComponent = WrappedComponent; - - static contextTypes = { - store: storeShape - }; - - static propTypes = { - store: storeShape - }; shouldComponentUpdate(nextProps, nextState) { if (!pure) { @@ -215,6 +205,17 @@ export default function createConnect(React) { ); } } + // adding properties in this way + // prevents ie8 from breaking + Connect.displayName = `Connect(${getDisplayName(WrappedComponent)})`; + Connect.WrappedComponent = WrappedComponent; + + Connect.contextTypes = { + store: storeShape + }; + Connect.propTypes = { + store: storeShape + }; if (process.env.NODE_ENV !== 'production') { Connect.prototype.componentWillUpdate = function componentWillUpdate() { diff --git a/src/components/createProvider.js b/src/components/createProvider.js index 1e351bc8a..3550d6a20 100644 --- a/src/components/createProvider.js +++ b/src/components/createProvider.js @@ -59,18 +59,7 @@ export default function createProvider(React) { ); } - return class Provider extends Component { - static childContextTypes = { - store: storeShape.isRequired - }; - - static propTypes = { - store: storeShape.isRequired, - children: (requireFunctionChild ? - PropTypes.func : - PropTypes.element - ).isRequired - }; + class Provider extends Component { getChildContext() { return { store: this.store }; @@ -102,5 +91,19 @@ export default function createProvider(React) { return Children.only(children); } + } + // adding properties in this way + // prevents ie8 from breaking + Provider.childContextTypes = { + store: storeShape.isRequired + }; + + Provider.propTypes = { + store: storeShape.isRequired, + children: (requireFunctionChild ? + PropTypes.func : + PropTypes.element + ).isRequired }; + return Provider; }