Imagine you have an array of news item. And if that array is empty you do not want to render your news list. Of course!
And maybe. Your api in that case does not give you the "news" key at all. And you have to write code like this:
if (!news || news.length === 0) return null;
Then I have news for you!
Use the new optional chaining syntax.
if (news?.lenght === 0) return null;
So clean!
And remember how to spell length.
Until next time!