Dan Neciu’s Post

💡 React just got a new native way to hide components Without killing their state 💀 I just tried the new Activity component introduced in React 19.2, and it’s one of those “finally” features that solve a long-standing UI pain point. Traditionally, hiding a component meant either: ⚠️unmounting it with &&, which kills all state ⚠️ or faking visibility with display: none, which keeps it alive but keeps running effects anyway <Activity> fixes this gap by letting React manage the lifecycle natively. When mode="hidden", React: 🧹 cleans up effects and active subscriptions ⏸ deprioritizes re-renders for better performance 💾 preserves the internal state for when it becomes visible again It’s not perfect, benchmarks show it’s slower with DOM-heavy components and adds some memory overhead, but for dashboards, tabbed UIs, or modals that reappear often, it’s a clean middle ground between complete unmounting and passive hiding. If you’re already experimenting with React 19, this one’s worth trying. Check out more React cool features in the comments 👇 #React19 #JavaScript #Frontend #WebDev #ReactJS

  • No alternative text description for this image

Great insight! 👏 Love how you explained the <Activity> component — it really clears up a long-standing React pain point.

Seems like the equivalent of v-show for vue.js

really interesting if react devs will really use that, as keeping the state means having more space allocated.

Like
Reply

Dan Neciu This looks super exciting! 🔥 I’ve always struggled with the balance between preserving state and avoiding unnecessary renders when hiding components. <Activity> feels like a game changer — finally a native solution to manage visibility without complex workarounds. Can’t wait to try this out in a dashboard use case! 🚀

Like
Reply

Finally! This closes one of the longest-standing gaps in React’s rendering model, true state-preserving hiding, natively.

Like
Reply
Dragos Ionita

Engineering Manager @ Adore Me

6mo

Finally! No more need things like && true = true || && <Fragment... as structural directives.

Very cool! Is there a reason that `mode` is a string rather than a boolean?

Like
Reply

very useful indeed, thanks !

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories