From bbd0c755f09964a41a36c16093a488a649d5090d Mon Sep 17 00:00:00 2001 From: Native E2E Date: Thu, 30 Jul 2026 14:25:16 +0300 Subject: [PATCH] fix(react): preserve Effect remount lifecycle Fixes #10 --- skills/.curated/react/metadata.json | 2 +- skills/.curated/react/references/conc-concurrent-safe.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/.curated/react/metadata.json b/skills/.curated/react/metadata.json index 34d600bb..88687656 100644 --- a/skills/.curated/react/metadata.json +++ b/skills/.curated/react/metadata.json @@ -1,5 +1,5 @@ { - "version": "1.2.4", + "version": "1.2.5", "organization": "React Best Practices", "technology": "React", "date": "May 2026", diff --git a/skills/.curated/react/references/conc-concurrent-safe.md b/skills/.curated/react/references/conc-concurrent-safe.md index 0a216049..0c68ffad 100644 --- a/skills/.curated/react/references/conc-concurrent-safe.md +++ b/skills/.curated/react/references/conc-concurrent-safe.md @@ -18,7 +18,7 @@ tags: conc, render-purity, side-effects, idempotent-render - Reading `window.innerWidth`, `document.cookie`, or other browser-only globals directly in render — works once, breaks under SSR and breaks again under interrupted renders. - A `Math.random()` or `Date.now()` value persisted into a `useState` initializer's body (the unwrapped form) instead of the lazy initializer — value changes on every render attempt. -The canonical resolution: side effects go in `useEffect`/`useLayoutEffect`; external state reads go through `useSyncExternalStore`; stable identifiers come from `useId` or `useRef`; "once on mount" intent is rare and should be expressed via an effect with an empty deps and ref-guarded body, not via render-body code. +The canonical resolution: synchronization with external systems goes in `useEffect`/`useLayoutEffect` with complete dependencies and cleanup that mirrors setup; external state reads go through `useSyncExternalStore`; stable identifiers come from `useId` or `useRef`; app initialization belongs at module scope or in a framework boot hook. Effects must remain correct across a setup → cleanup → setup cycle. **Incorrect (side effects during render):**