React 19.2
Activity, useEffectEvent, cacheSignal (RSC-only), Performance Tracks, partial prerender APIs, and batched SSR Suspense reveals. · 5 lessons · click a card to expand
Part of the React 16 → 19.3 evolution reference. Expand a card, then use chapter links in the sidebar.
cacheSignal is [RSC] only. Partial prerender APIs are for framework authors (react-dom/server, react-dom/static). useEffectEvent and <Activity> are core react APIs for application developers.
Why 19.2 mattered
1 item0119.2 adds Activity, Effect Events, and prerender resumeReact 19.2
Activity), read latest props in effects without re-subscribing (useEffectEvent), and see React work in Chrome Performance (Performance Tracks).| Feature | Package | Audience |
|---|---|---|
<Activity> | react | App / design systems |
useEffectEvent | react | App |
cacheSignal | react | RSC only |
| Performance Tracks | DevTools | Debugging |
resume / resumeAndPrerender / … | react-dom/server & static | Frameworks |
| Batched SSR Suspense reveals | react-dom | SSR UX |
| Node Web Streams | react-dom/server | Node SSR |
useId default prefix _ | react | All |
eslint-plugin-react-hooks v6 | eslint | DX / compiler |
ViewTransition is not the 19.2 headline as a stable API — it is stable in 19.3. 19.2 mentions it as upcoming when explaining batched Suspense reveals.hidden tab panel with <Activity> if you need to keep form state.Activity
1 item02Activity hides children but can keep their stateReact 19.2
<Activity mode="visible" | "hidden"> shows or hides a subtree. Hidden content is not visible, effects are torn down, but state can be preserved so coming back is instant.import { Activity } from "react";
function Settings({ tab }) {
return (
<>
<Activity mode={tab === "profile" ? "visible" : "hidden"}>
<ProfileForm />
</Activity>
<Activity mode={tab === "billing" ? "visible" : "hidden"}>
<BillingForm />
</Activity>
</>
);
}Unlike {tab === "profile" && <ProfileForm />}, switching away from Profile does not necessarily destroy useState inside ProfileForm. Unlike CSS display: none alone, React can skip rendering work and not run effects while hidden.
Why it was introduced?
Tabs, sidebars, and mobile stacks either:
- Unmounted (lost draft text), or
- Stayed mounted with
hidden(effects, subscriptions, and CPU still ran)
Activity is the third mode: hidden to React’s scheduler, state retained.
Before 19.2
{tab === "profile" ? <ProfileForm /> : null}
// or
<div hidden={tab !== "profile"}><ProfileForm /></div>Real-world examples
1. SaaS settings tabs — keep the profile form draft when the user peeks at billing.
2. E-commerce filters drawer — hide the filter panel on mobile without resetting selected facets.
3. Chat: conversation list vs thread on a small screen — keep scroll position in the list.
When should I use it?
UI that is toggled often and is expensive to remount, where keeping state is desired.
When should I NOT?
- Truly leaving a flow (logout, completed checkout) — you want to reset
- Giant hidden trees you will never reopen (waste memory)
- Replacing routing; this is not a router
Common mistakes
- Using Activity instead of unmounting when you must re-run
useEffectsetup (you might want unmount) - Forgetting hidden trees still cost memory
Related APIs
display: none, tabs, 19.3 ViewTransition (animate Activity reveals)
Interview notes
- 19.2.
- Preserve state, drop effects while hidden.
- Not a modal API.
useEffectEvent
1 item03useEffectEvent extracts non-reactive logic from EffectsReact 19.2
useEffectEvent(fn) returns a stable function that always sees the latest props/state when called, without being a dependency that re-runs the Effect.theme / userId. If you put theme in the dependency array, you resubscribe on every theme change — wrong if the socket should stay open.function Chat({ roomId, theme }) {
const onMessage = useEffectEvent((message) => {
showToast(message, theme);
});
useEffect(() => {
const conn = connect(roomId);
conn.on("message", onMessage);
return () => conn.disconnect();
}, [roomId]);
}onMessage is not listed in deps. It is not reactive. theme updates do not reconnect. Incoming messages still use the current theme.
Why it was introduced?
eslint-disable-line react-hooks/exhaustive-deps + useRef “latest” pattern was the unofficial API. 19.2 makes it official.
Before 19.2
const themeRef = useRef(theme);
themeRef.current = theme;
useEffect(() => {
const conn = connect(roomId);
conn.on("message", (m) => showToast(m, themeRef.current));
return () => conn.disconnect();
}, [roomId]);Real-world examples
1. Chat socket — reconnect only when roomId changes; log with latest user.
2. Analytics `page_view` — Effect depends on pathname; event handler reads latest experimentFlags without re-firing.
3. IntersectionObserver infinite scroll — observer created once per sentinel; callback reads latest hasMore / page.
When should I use it?
Logic that happens inside an Effect’s subscription but should not resubscribe when that data changes.
When should I NOT?
- Values that should re-run the Effect (put them in the dependency array)
- Event handlers for
onClick(plain functions /useCallbackas usual — this is not a click helper) - As a replacement for
useCallbackeverywhere
Common mistakes
- Calling
useEffectEventfunctions during render (they are for events/effects) - Putting the Effect Event into the dependency array (defeats the point)
Related APIs
useEffect, useRef latest pattern, useCallback
Interview notes
- 19.2.
- Latest props without re-running the effect.
- Official “effect event” from the docs on separating events from effects.
theme *should* reconnect, theme belongs in the Effect deps, not in an Effect Event.cacheSignal (RSC)
1 item04cacheSignal tells you when a cache() lifetime endsReact 19.2RSC
cacheSignal() is only for React Server Components. It relates to cache() from react — a per-request memo for server functions.cache(fn) dedupes fn for the rest of a server request. cacheSignal() gives an AbortSignal (or equivalent lifetime) so you can abort fetches when that cache lifetime is over (navigation, cancel).You cannot use this in a Vite CSR app. There is no cache() request scope.
Real-world examples (RSC / Next.js)
1. Server Component product fetch — abort if the request is cancelled.
2. Deduped `getUser()` across layout + page in one request.
3. Downstream HTTP with fetch(url, { signal: cacheSignal() }) if your runtime documents that pattern.
When should I NOT?
Client Components. SPAs. Pretending cache() is useMemo.
'use client'.Performance Tracks, prerender, and other 19.2
1 item05Performance Tracks and framework SSR APIsReact 19.2
resume* APIs let a framework prerender a shell and resume later.Performance Tracks
Open Performance in Chrome, record an interaction. React 19.2 can show scheduler / component tracks so you see a transition vs an urgent update without guessing. This is DX, not a hook.
Partial prerender (frameworks)
prerender(app) → HTML shell + postponed state
later: resume(postponed, ...) → stream the restNext.js Partial Prerendering [framework] is the product name; React’s resume / resumeAndPrerender / Node variants are the primitives. App developers use the framework’s config, not these functions directly.
Batched SSR Suspense reveals
SSR now batches revealing multiple Suspense holes more like the client, which matters for animation (and 19.3 View Transitions). You may see fewer one-by-one pops on first paint.
Node Web Streams
prerender / renderToReadableStream style APIs on Node without only Pipeable streams. Framework authors / custom servers.
useId prefix
Default IDs use _ instead of : — another reason not to hard-code generated ids in tests.
eslint-plugin-react-hooks v6
Supports the latest hook rules (including Effect Events / compiler-related). Upgrade ESLint with React 19.2.
Real-world examples
1. Debugging a janky filter — Performance Tracks show the transition lane.
2. Next.js PPR commerce homepage — static shell, dynamic cart hole resumed on request [framework].
3. Custom Node SSR — Web Streams on Node 22 for a streaming response.
resumeAndPrerender in an application component file.useTransition search in Performance with React 19.2 and look for React’s tracks.