StrictMode examples

Uncomment alert to see effects.

react-17-use-memo/state

React 17 examples

react-18-use-effect

React 18 examples

Read it

Strict Mode - React

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.

So…

  1. Callbacks in useState, useMemo, useReducer, useCallback must be pure functions.
  2. Callbacks in useEffect must be idempotent functions, details.
  3. Data fetching should not be executed in React-area.

react-18-data-fetching

Right fetching example