
React 19.2 Activity API: Hide Components Without State Loss
Summary
Use <Activity> in React 19.2 to hide UI while preserving state, DOM, and scroll position.
React 19.2 shipped a primitive frontend developers have wanted for years: a built-in way to hide part of a component tree without unmounting it. The new <Activity> component preserves state, DOM nodes, scroll position, and even prefetched data — so when you show that section again, it picks up exactly where it left off. No more rebuilding lists. No more refetching. No more lost form input.
This guide walks through the <Activity> API end-to-end with runnable examples, covers what actually happens to effects when you flip mode, and explains the gotchas that bit us in production. By the end you will know exactly when to reach for it and when to keep using display: none or conditional rendering.
Keep reading — it's free
Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.
Already a member? Sign in
Comments (1)
M. K. Pathan