DEV Community

Discussion on: Stop returning NULL components

Collapse
 
ucvdesh profile image
Daniel Silva

It's a common practice but not a good practice, tho. And could have a little impact on performance depending on what you're doing, that's why I told that may potentially impact your performance. When managing big apps with a lot of functionalities, those extra re-renders will drop the performance of the app.

You can try it by using a ChildComponent and put a console.log('re-render') and you will see the multiple logs on the console. Now, imagine that you have it on a component like a form, that will set a new state on every key press and you have just 3 component that return null or false...It will do a lot of re-rendering just for 3 components with a bad conditional rendering.