DEV Community

Discussion on: React Anti-pattern: renderThing

Collapse
 
mgtitimoli profile image
Mauro Gabriel Titimoli • Edited

There are times where creating a new component doesn't make sense and breaking the jsx into small render functions is not a bad idea as it follows what we do in other contexts, like for example when there is a big function and we break it into smaller ones to improve legibility.

Having said this, there are times this is overused, and for these cases I agree it would be better to extract that into another component.

To summarize, it's never a good idea to go with an "all or nothing" approach, imo it's better to be on a "it's depends" motto and evaluate the case.

Having render helpers is not a bad idea or antipattern but we should not overuse this and create another component(s) given the case.