![reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow](https://i.stack.imgur.com/kt1X8.png)
reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow
![Hey! I'm having a issue where the console.log() statement executes before the .map() function. So it logs out a empty array. I tested by putting the log inside the map, it prints Hey! I'm having a issue where the console.log() statement executes before the .map() function. So it logs out a empty array. I tested by putting the log inside the map, it prints](https://preview.redd.it/hey-im-having-a-issue-where-the-statement-executes-before-v0-8t1p24kt1yna1.png?width=640&crop=smart&auto=webp&s=c22e68c81ca388bc39136eeaff8b63191413bd7d)
Hey! I'm having a issue where the console.log() statement executes before the .map() function. So it logs out a empty array. I tested by putting the log inside the map, it prints
![javascript - react js useState array is empty in first time click in the console log - Stack Overflow javascript - react js useState array is empty in first time click in the console log - Stack Overflow](https://i.stack.imgur.com/h7l4v.png)
javascript - react js useState array is empty in first time click in the console log - Stack Overflow
![Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube](https://i.ytimg.com/vi/zv8g_3mVthc/sddefault.jpg)
Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube
![reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow](https://i.stack.imgur.com/9ejyi.png)
reactjs - response is shown in network but returns empty array when logged in console (React) - Stack Overflow
![Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube](https://i.ytimg.com/vi/Y2CU64IhirQ/hq720.jpg?sqp=-oaymwEhCK4FEIIDSFryq4qpAxMIARUAAAAAGAElAADIQj0AgKJD&rs=AOn4CLCm2235St3u-RKdg5zf7st5QZGcew)
Where to Console Log in React JS | 6 Proper Ways to Console Log in React JS | Learn React JS - YouTube
![How to test console output (console.log, console.warn) with RTL (React-Testing-Library) and Jest | by Ilya Zykin | Medium How to test console output (console.log, console.warn) with RTL (React-Testing-Library) and Jest | by Ilya Zykin | Medium](https://miro.medium.com/v2/resize:fit:2000/1*-MvgWMaeWVeme-ZKEw-UkA.png)