DEV Community

Discussion on: Conditionally render react components in cleaner way

Collapse
 
dungmidside profile image
Dung Tran

A downside of enum solution is all the component will be compiled even it doesn't need to rendered

Collapse
 
ridays2001 profile image
Riday

So, we have to compromise on performance to get clean code?

Collapse
 
hey_yogini profile image
Yogini Bende

Not really. Check what Luke have shared!

Thread Thread
 
ridays2001 profile image
Riday

Hmm... Makes sense... Nice article!

Collapse
 
hey_yogini profile image
Yogini Bende

We can use enums more creatively and achieve performance as well. Luke have shown a really good example for that below.