Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/components/createConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
27 changes: 15 additions & 12 deletions src/components/createProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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;
}