Uncomment alert
to see effects.
React 17 examples
React 18 examples
alert
? Because React uses monkey patching to hide this effect from console.log
Current behavior of StrictMode
Adding Strict Effects to StrictMode · Discussion #19 · reactwg/react-18
Future behavior of StrictMode
Discussions · reactwg/react-18
Working group’s discussions. It’s a pretty interesting content, you can filter it by category “Announcements“. I recommend to read it.
useState
, useMemo
, useReducer
, useCallback
must be pure functions.useEffect
must be idempotent functions, details.Right fetching example