@@ -22,11 +22,7 @@ export function Re(Component) {
2222 }
2323 }
2424
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 ;
2825 let setState = this . setState ;
29-
3026 if ( process . env . NODE_ENV !== "production" ) {
3127 this . setState = ( ) => {
3228 const name = this . displayName || this . constructor . name ;
@@ -38,39 +34,6 @@ export function Re(Component) {
3834 } ;
3935 }
4036
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-
7437 // Sends an `action` to the reducer. The `reducer` must handle this action
7538 // and return either `NoUpdate()`, `Update(state)`, `SideEffects(fn)`, or
7639 // `UpdateWithSideEffects(state, fn)`.
0 commit comments