Skip to content

Commit 4ad1002

Browse files
committed
subscribe moved from Connector constructor to componentDidMount
1 parent c1964b0 commit 4ad1002

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/createConnector.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ export default function createConnector(React) {
3838
constructor(props, context) {
3939
super(props, context);
4040

41-
this.unsubscribe = context.redux.subscribe(::this.handleChange);
41+
this.redux = context.redux;
4242
this.state = this.selectState(props, context);
4343
}
4444

45+
componentDidMount() {
46+
this.unsubscribe = this.redux.subscribe(::this.handleChange);
47+
}
48+
4549
componentWillReceiveProps(nextProps) {
4650
if (nextProps.select !== this.props.select) {
4751
// Force the state slice recalculation

0 commit comments

Comments
 (0)