How to make fetch request on server before sending html to client?
Hello everyone, I have a question about fetching data. I want to fetch data from an api and send html based on what I fetch.
The way I have it set up now results in the console.log(res); in the async fetchData function giving me the correct result, but the console.log(data); returns this:
Question: How do I make the sending of the html to the frontend wait until the async function has completed
What I have tried: I have already tried to make the function Home() async. This resulted in the whole component not rendering.
Help would be appreciated!
The way I have it set up now results in the console.log(res); in the async fetchData function giving me the correct result, but the console.log(data); returns this:
Question: How do I make the sending of the html to the frontend wait until the async function has completed
What I have tried: I have already tried to make the function Home() async. This resulted in the whole component not rendering.
Help would be appreciated!