So, there are some logic issues here. First of all, the best way to fetch data in react is doing that inside the use effect, and the dependencies of the use effect need to be the state, so you can update the state with a fetch when page is load. This is an example:
const [data, setData] = useState([])
UseEffect(()=>{ Fetch(“https://yourapihere.com/apo”).then(res => res.json()).then(res => setData(res)) }, [data])
So if you do this, after the load of the page you will get the result right!