Get updated data in useEffect

I try to fetch data using useEffect. Trying this i get many renders in the fetching process. Ex: first render:
data = [], second render = [{...}{...}]. So the data array is populated just after 2 render. Why? and how to get data a the first render?

Read more here:

Content Attribution

This content was originally published by Asking at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: