Everything works fine, but I have this warning Expected to return a value at the end of arrow function array-callback-return
. I tried using forEach
instead of map
, but then <CommentItem />
doesn't even show. How do I fix this?
A map()
creates an array, so a return
is expected for all code paths (if/elses).
If you don't want an array or to return data, use forEach
instead.