~/talk

Using useEffect Effectively

Talkat React Advanced 2022 · 2022-10-21..10-24· [react]
slides:none on file

Argues that useEffect is for ongoing activity effects (subscriptions, listeners) not for one‑off action effects, shows React 18’s double‑exec on mount (strict mode in dev) causing refetch and race issues, and demonstrates fixing a thumbnail→fullscreen video example by replacing three tangled useEffects with explicit event handlers and a state‑machine (XState) transition. Recommends concrete tools: useSyncExternalStore, React Query/SWR/Next.js loaders for fetching, and moving fire‑and‑forget logic out of useEffect.

AI-written summary · about

  1. 0:00useEffect introduction and challenges
  2. 3:15Dependency array and loops
  3. 6:23React 18 strict mode
  4. 9:13Activity vs action effects
  5. 13:05When not to use useEffect
  6. 17:23Fetching data without useEffect
  7. 20:33Handling user events outside useEffect
  8. 23:45Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.