Fetching data in root.jsx
I have solidStart connected to a local postgre database. I can fetch data from it in files in the "routes" folder using createServerData$ and useRouteData. But that doesn't work in root.jsx. I was hoping to populate a navbar with items from the database.
Maybe there is another way to show a component on every route(in this case the nav bar) that can also useRouteData? Or maybe I need to setup an API route to fetch data fro root.jsx?
2 Replies
I guess you can just do this:
const data = createServerData$(() => getAllData())
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View