DEV Community

Discussion on: Cleaner React: Conditional Rendering

 
ramblingenzyme profile image
Satvik Sharma

For sure, which is why most of the time I prefer calculating as much as possible in plain JS so the JSX is mostly just JSX, even if it's just putting the ternaries into constants

Thread Thread
 
sturdynut profile image
Matti Salokangas

Totally. You can clean up a ton of JSX by extracting variables and doing calculations prior to rendering. That is a great point and I find myself doing those refactors when I'm trying to make components more readable.