Skip to content
Advertisement

fetching data in react returns an empty array

i’m fetching data from my backend api and setting the data to my state but it’s returning an empty array and idk why this happening even though in other components it works just fine

this is my code :

JavaScript

Advertisement

Answer

I was just missing a return in the .map function

Advertisement