Description
What is the current behavior?
If componentWillMount
has multiple setState
calls, only the last one works in shallow renderer
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
https://www.webpackbin.com/bins/-Kw11Ya_ZJ1BcL0rpDKj
Here, DOM renderer correctly renders "Hello, world" while test shallow renderer renders "undefined, world".
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Issue is introduced in React 16.
The reason must be those lines, replacing publicInstance.state
with this._renderer._newState
should fix it:
react/src/renderers/testing/ReactShallowRendererEntry.js
Lines 212 to 215 in e932ad6