File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export default function createConnector(React) {
40
40
41
41
this . handleChange = this . handleChange . bind ( this ) ;
42
42
this . unsubscribe = context . redux . subscribe ( this . handleChange ) ;
43
- this . handleChange ( ) ;
43
+ this . state = this . selectState ( { context , props } ) ;
44
44
}
45
45
46
46
componentWillReceiveProps ( nextProps ) {
@@ -55,14 +55,13 @@ export default function createConnector(React) {
55
55
}
56
56
57
57
handleChange ( ) {
58
- const state = this . context . redux . getState ( ) ;
59
- const slice = this . props . select ( state ) ;
58
+ this . setState ( this . selectState ( ) ) ;
59
+ }
60
60
61
- if ( this . state ) {
62
- this . setState ( { slice } ) ;
63
- } else {
64
- this . state = { slice } ;
65
- }
61
+ selectState ( { context, props } = this ) {
62
+ const state = context . redux . getState ( ) ;
63
+ const slice = props . select ( state ) ;
64
+ return { slice } ;
66
65
}
67
66
68
67
render ( ) {
You can’t perform that action at this time.
0 commit comments