JV
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
Im now working with this in mind - trying to create composable which allows me to fetch data of HomePage on SSR and on client either, when I come from another subpage. This is just example in my mind, but I dont think this will be ok too.. @manniL / TheAlexLichter - this immediate: false and calling execute is important for me - Im executing it from another composable
32 replies
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
@manniL / TheAlexLichter thank you for your answer!
Ill try to explain "some purposes"
we are using "useFetch" with our wrapper, which provides some events like "onSuccess", "onError" etc. In some cases, we need to modify data that comes from api call - this maybe could be achieved by computed properties. But I would like to keep our wrapper with "onSuccess", "onError" events
32 replies
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
I tried to refactor it this way:
But the homePageLoaded is not synced properly and I dont think using
useState
for this is a good way... could you please help/explain, how to refactor it with the smallest amount of other code changes possible?32 replies