#How can I access root data?
18 messages · Page 1 of 1 (latest)
Might need more detail, can you just export and import it where needed? What kind of data
@dark glade I've found that, in StartClient, it's checking for root.data.ts and if it exports default function for fetching data, it fetches it, but I can't find a way to access that data, useRouteData doesn't return it
@plain stone @hallow scroll maybe you know something about this? sorry for tagging
this is from solid-start/entry-client/StartClient.tsx
that dataFn is fed to StartRouter
#legacy-help message
const rootData = useData(0); this useData is no longer exported.
@steep wren maybe you know up to date way to access root data
I’m not sure, perhaps the router mechanic changed and I have no idea
maybe @wet compass knows how it can be used
Right.. it is probably about where it is used. Technically useRouteData should return it, but the read might need to happen lower down... it also feeds into the data property of child routeData's
thanks for the response. I've tried using useRouteData almost everywhere, can't find that root data anywhere
It gets passed through the routeData itself.. like you need to re-send it..
export const routeData = ({ data }) =>
got it, thanks!
If there is no routeData for the route then it should just use that instead
What I was thinking was, that I have some external JSON for i18n, which holds language data. So I thought, I would've fetched it with root.data.ts and then pass it to i18n's provider via useRouteData.