Capítulo 66 de 116
<Activity> lets a subtree be visually hidden and de-prioritized while keeping its component state alive — the built-in primitive for "keep this screen/tab mounted in the background" UX (tab switching, pre-rendering the next likely screen) without losing scroll position, form input, or other local state.
<Activity mode="visible"> (default, renders and displays normally) and <Activity mode="hidden"> (keeps the subtree mounted with its state intact, but visually hidden and deprioritized for rendering work).Activity modes preserves its internal state, unlike unmounting it (Ch 30) — this is the mechanism behind, e.g., switching between app tabs without losing each tab's scroll position or in-progress form state.Activity subtree are processed at lower priority than visible UI — useful for pre-rendering a likely-next screen in the background without competing with the currently visible UI's responsiveness.Activity subtree similarly to being "paused," not identical to a fully active mount, which matters for any Effect-driven subscriptions/connections inside it.<Activity mode={activeTab === 'posts' ? 'visible' : 'hidden'}>
<PostsTab />
</Activity>
PostsTab's state (scroll position, any local useState) survives switching away to a different tab and back, because it stays mounted under Activity rather than being unmounted.Activity when you need "hide but keep state" semantics — plain conditional rendering (Ch 16) unmounts and loses state entirely.Activity.