S
SolidJS13mo ago
dion

whats the use case of routeData and useRouteData

From my understanding, it seems possible to directly get the data needed using ‘createServerData$’ to fetch the data on the server, or is that an anti-pattern? From the docs, it seems that routeData is called once per route, but in most apps that i’ve built, i usually do the data fetching at the component that needs it. I.E, i’ll have pass it down as props.
1 Reply
dion
dion13mo ago
Thanks for the response! That gave me some insights! On that note, i’ve got some follow up questions: - How do we run useRouteData on the component level? Basically I break down my components that i use from a page into another folder, is it as simple as defining all the queries at the page level, then doing an import of the routeData in the component level, and selecting the resource which i need? - for createSeverData$, when there’s new data in the system, how do i trigger refetching of the data?
Want results from more Discord servers?
Add your server