Closed gomorizsolt closed 4 years ago
Is it just me or is it weird that a function is defined in the middle of the component logic?
I didn't find it weird. Though if it's confusing, let's move it to the top.
Does !languages necessarily mean an error?
I'd like to avoid looping over falsy values even if there's not much chance of it. We can omit this if it clutters the logic though.
How about an empty repo for example?
Empty repositories return empty objects which means they're converted to empty arrays.
(1) If the repository is empty, once the fetch is fulfilled, data
becomes {}
.
(2) Calling the filter()
method on an empty object returns an empty array.
(3) Looping over an empty array with map()
is obviously fine.
I hope this breakdown answers your question.
Issue #128 (there's also an explanation).
Let's use early-returns to break
renderLanguages()
.