Bug: Strange double invocation of hook's setState in strict mode #23081
Labels
Component: Developer Tools
Resolution: Expected Behavior
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
React version: 17.0.2
Steps To Reproduce
Unfortunately, I cannot provide a small reproducible example of my issue. It occurs randomly in some specific component hierarchies. I can provide the problematical code and investigate this issue further if I get at least some hints why it may happen.
This is a simplification of my code:
The current behavior
React appends the data twice, however, there is only one 'setting state' printed. I detect second invocation via debugger. The console.log('appending') is printed once.
The expected behavior
'setting state' is printed twice. I may assume that I'm doing something wrong, but I cannot find any explanation why on the second invocation nothing gets printed in console.
I expect that on both invocations the old state is equal. However, it seems like the second invocation gets updated state from the first one.
The text was updated successfully, but these errors were encountered: