You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "problem" here is that we do not have a "DEV Mode" as react has. We might want to add this to preact/debug though since I understand this "feature" more as a hint for developers to not rely on side effects in sCU as it might be called multiple times in the future (concurrent mode).
Would you be happy with having this in preact/debug?
Edit: This should not only apply for sCU but also for:
Class component constructor, render, and shouldComponentUpdate methods
Class component static getDerivedStateFromProps method
Function component bodies
State updater functions (the first argument to setState)
Functions passed to useState, useMemo, or useReducer
Since we don't have a dev mode, we won't be adding this feature. It's not an API decision, it's a forcing function the react team is using to make sure developers don't rely on lifecycle timing semantics. Preact is not changing those timing semantics, so we have no reason to intentionally break them as a developent aide. No code should ever be relying on sCU being called twice, doing so would be a hack.
Reproduction
Steps to reproduce
Type "a" in the email input.
Expected Behavior
Console log shows the value "a" twice.
Actual Behavior
Console log shows the value "a" once.
Note
React added this change in the following PR: facebook/react#17942
The text was updated successfully, but these errors were encountered: