Q56: What is the Activity (formerly Offscreen) component in React?
The <Activity> component (previously known as Offscreen) enables hiding UI trees while preserving their state and DOM nodes. When marked mode hidden, React sets DOM visibility to hidden and lowers the priority of updates inside that tree, allowing instant state restoration when switching back without re-mounting.
Key Takeaways
- Preserves component state and DOM nodes when hiding UI off-screen.
- Enables instant tab or view switching without losing user state or re-executing mounts.
Knowledge Check
What is the primary operational advantage of React's Activity (Offscreen) mechanism over conditional rendering ({show && <Child />})?