@@ -22,11 +22,7 @@ export function Re(Component) {
22
22
}
23
23
}
24
24
25
- // We might overwrite setState later for the Immutable.js helpers, thus we
26
- // keep a reference to the original method around as well.
27
- const originalSetState = this . setState ;
28
25
let setState = this . setState ;
29
-
30
26
if ( process . env . NODE_ENV !== "production" ) {
31
27
this . setState = ( ) => {
32
28
const name = this . displayName || this . constructor . name ;
@@ -38,39 +34,6 @@ export function Re(Component) {
38
34
} ;
39
35
}
40
36
41
- // We allow a hidden `Component#unstable_initialImmutableState` option to
42
- // initialize the component state based on a returned Immutable.js record
43
- // type.
44
- //
45
- // To manage the state, we define a couple of helper methods to make it
46
- // work as a regular Component state must always be a plain JavaScript
47
- // object.
48
- //
49
- // To emulate an Immutable.js object, we use a JavaScript object
50
- // consisting of only one key: `immutableState`. To make the render method
51
- // easier, we also expose `Component#immutableState` to access the
52
- // components state since we don't want to overwrite `Component#state`.
53
- //
54
- // Note that this is unstable API and should not be used.
55
- if ( typeof this . unstable_initialImmutableState === "function" ) {
56
- this . state = {
57
- immutableState : this . unstable_initialImmutableState ( props )
58
- } ;
59
-
60
- setState = ( updater , callback ) => {
61
- originalSetState . call (
62
- this ,
63
- ( state , props ) => ( {
64
- immutableState : updater ( state . immutableState , props )
65
- } ) ,
66
- callback
67
- ) ;
68
- } ;
69
- Object . defineProperty ( this , "unstable_immutableState" , {
70
- get : ( ) => this . state . immutableState
71
- } ) ;
72
- }
73
-
74
37
// Sends an `action` to the reducer. The `reducer` must handle this action
75
38
// and return either `NoUpdate()`, `Update(state)`, `SideEffects(fn)`, or
76
39
// `UpdateWithSideEffects(state, fn)`.
0 commit comments