Closed karangarg45 closed 4 years ago
Hi @karangarg45,
I don't think there's any real observable difference here. Given that it's all about your preference and for me, I prefer to render null
when I want nothing rendered. Fragments are intended to encapsulate children and if I saw an empty fragment I would be confused why it's there 🤷♂️
Hi Kent,
In react if you want to render nothing either you can return null from the component or you can render an empty fragment.
Is there any disadvantage of using
<React.Fragment/>
overnull
.What are your thoughts on this? I think usingReact.Fragment
is more explicit and shows developer's intent