React Activity component
Today I learned about React 19.2’s new <Activity> component.
<Activity mode={isShowingSidebar ? "visible" : "hidden"}>
<Sidebar />
</Activity>
When mode="hidden", React unmounts all useEffect, it keeps state cached and yet the DOM stays rendered via display: none.
Switching back to mode="visible" restores the view instantly with its previous state and fire all useEffect again.
This is perfect for tabs, modals, and any UI you want ready-to-go.
reference: React Activity docs
Tweet