Commit e531375 Orkun Tumer
committed
1 parent f3a4e99 commit e531375 Copy full SHA for e531375
File tree 2 files changed +3
-7
lines changed
2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export function connect(mapStateToProps, actions) {
24
24
const store = context . store ;
25
25
let state = mapStateToProps ( store ? store . getState ( ) : { } , props ) ;
26
26
const boundActions = actions ? mapActions ( actions , store ) : { store } ;
27
- let update = ( ) => {
27
+ const update = ( ) => {
28
28
let mapped = mapStateToProps ( store ? store . getState ( ) : { } , props ) ;
29
29
for ( let i in mapped ) if ( mapped [ i ] !== state [ i ] ) {
30
30
state = mapped ;
@@ -35,13 +35,11 @@ export function connect(mapStateToProps, actions) {
35
35
return this . setState ( { } ) ;
36
36
}
37
37
} ;
38
+ store . subscribe ( update ) ;
38
39
this . componentWillReceiveProps = p => {
39
40
props = p ;
40
41
update ( ) ;
41
42
} ;
42
- this . componentDidMount = ( ) => {
43
- store . subscribe ( update ) ;
44
- } ;
45
43
this . componentWillUnmount = ( ) => {
46
44
store . unsubscribe ( update ) ;
47
45
} ;
Original file line number Diff line number Diff line change @@ -39,13 +39,11 @@ export function connect(mapStateToProps, actions) {
39
39
return this . forceUpdate ( ) ;
40
40
}
41
41
} ;
42
+ store . subscribe ( update ) ;
42
43
this . UNSAFE_componentWillReceiveProps = p => {
43
44
props = p ;
44
45
update ( ) ;
45
46
} ;
46
- this . componentDidMount = ( ) => {
47
- store . subscribe ( update ) ;
48
- } ;
49
47
this . componentWillUnmount = ( ) => {
50
48
store . unsubscribe ( update ) ;
51
49
} ;
You can’t perform that action at this time.
0 commit comments