DEV Community

Discussion on: A Clean Way to Conditionally Render Components

Collapse
 
martinpham profile image
Martin Pham • Edited

Your idea is nice. However I think having an component would be overkill. Since the embed conditional rendering is already good.

I’d like to add a bit. Since you want to render the ComponentX only with some conditions, it’d be better if you could lazy load it. So it will be downloaded only when we need, therefore downsize the initial bundle. Lazy and Suspense can help you to do it.