Why the data i get from the useQuery it's undefined on the first render?
So i have this file with my axios request:
And this is in other file where im using useQuery
Why my todosData from usingQuery is undefined at first render and only take the data from resquest if i save the request file?
Is there a way to in first render the todoData render the data from request?
4 Replies
exotic-emerald•8mo ago
Your getTodos needs to finish executing first before any data is available
todosData is returned as ref. If you use it in the template it will re-render when data is available
rare-sapphireOP•8mo ago
So im using the todosData as the data for a tanstack table, in this case as the data prop of useVueTable.
So apparently i was passing todoData.value to my data prop of table, but the correct aproach is only pass todoData, but why ?
exotic-emerald•8mo ago
Not sure how to answer this. Because it is how Vue reactivity fundamentally works
rare-sapphireOP•8mo ago
hmm understand, btw ty for the help ^^