dillon1000/react

Commit

New class instantiation and initialization process

This allows state to be set up in the constructor instead of through
getInitialState. getInitialState is now considered part of "classic".
Therefore, they move into ReactClass's constructor.

As a consequence of this, we no longer have a mapping between the internal
representation and the public instance during the mounting process.
Because the constructor hasn't returned yet.

We used to have a special case for calling setState in getInitialState
which was just ignored. This makes that throw and the component is
considered unmounted during the construction phase.
Browse files
Changed paths5 files
First-parent comparison
M src/classic/class/ReactClass.js ModifiedM src/core/ReactCompositeComponent.js ModifiedM src/core/__tests__/ReactComponentLifeCycle-test.js ModifiedM src/core/__tests__/ReactCompositeComponent-test.js ModifiedM src/modern/class/__tests__/ReactES6Class-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…