<p dir="auto"><strong>Do you want to request a <em>feature</em> or report a <em>bug</em>?</strong><br>
I believe there is a bug in React 16.4 regarding the <code class="notranslate">getDerivedStateFromProps</code>.</p>
<p dir="auto"><strong>What is the current behavior?</strong><br>
Trying to set the state based on the props kind of overrides the state forever, which makes it impossible to edit it later on.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (<a href="https://jsfiddle.net/Luktwrdm/" rel="nofollow">https://jsfiddle.net/Luktwrdm/</a>) or CodeSandbox (<a href="https://codesandbox.io/s/new" rel="nofollow">https://codesandbox.io/s/new</a>) example below:</strong><br>
Example is as follows: <a href="http://jsbin.com/yawasoz/1/edit?html,js,output" rel="nofollow">http://jsbin.com/yawasoz/1/edit?html,js,output</a><br>
Add some item, click on it, try to edit it.</p>
<p dir="auto"><strong>What is the expected behavior?</strong><br>
To work like this (React 16.3): <a href="http://jsbin.com/luzimujiwi/1/edit?html,js,output" rel="nofollow">http://jsbin.com/luzimujiwi/1/edit?html,js,output</a></p>
<p dir="auto"><strong>Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?</strong><br>
I think this happens only in React 16.4, 16.3 seems to work fine (same code, different React version): <a href="http://jsbin.com/luzimujiwi/1/edit?html,js,output" rel="nofollow">http://jsbin.com/luzimujiwi/1/edit?html,js,output</a></p>
<p dir="auto">According to semver, only non-breaking changes are supposed to go into minor and patch version releases. With the release of 16.4, you have made breaking changes to <code class="notranslate">getDerivedStateFromProps</code>. Our entire codebase, running perfectly on 16.3.2 is a dumpster fire as soon as we raise that dependency to 16.4.</p>
<p dir="auto">The only thing in your CHANGELOG about this <em>breaking</em> change is:</p>
<blockquote>
<p dir="auto">Properly call getDerivedStateFromProps() regardless of the reason for re-rendering. (<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/acdlite/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/acdlite">@acdlite</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="313087680" data-permission-text="Title is private" data-url="https://github.com/facebook/react/issues/12600" data-hovercard-type="pull_request" data-hovercard-url="/facebook/react/pull/12600/hovercard" href="https://github.com/facebook/react/pull/12600">#12600</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="322993706" data-permission-text="Title is private" data-url="https://github.com/facebook/react/issues/12802" data-hovercard-type="pull_request" data-hovercard-url="/facebook/react/pull/12802/hovercard" href="https://github.com/facebook/react/pull/12802">#12802</a>)</p>
</blockquote>
<p dir="auto">Please revert this change and save it for 17.0.0, or provide proper documentation to what this change actually entails so that its use can be adjusted by those who have already implemented <code class="notranslate">getDerivedStateFromProps</code>.</p>