Loading...
{tab === 'drafts' && <Drafts />}
{tab === 'sent' && <Sent />}<Activity mode={tab === 'drafts' ? 'visible' : 'hidden'}>
<Drafts />
</Activity>
<Activity mode={tab === 'sent' ? 'visible' : 'hidden'}>
<Sent />
</Activity>Hidden tabs keep their state and DOM instead of unmounting, so a half-typed draft is still there when the user comes back.
<Activity mode='hidden'> instead of {show && <Panel />} when its state must survive.React runs their cleanups when the tree is hidden and runs their setups again when it becomes visible.
Both hide the DOM, but <Activity> also cleans up Effects and gives hidden updates low priority, so hidden UI does not compete with visible UI.
Yes, but at a lower priority than visible content. This lets React prepare hidden UI in the background without slowing down the page.