SolidJSS
SolidJSโ€ข4y agoโ€ข
7 replies
Kasper

Why dose createServerData$ return undefined

I am learning solid start, i am having some issues getting routeData and createServerData to work correctly, the below example prints Test: undefined where it should return Test: { Foo: "Bar" }
export function routeData() {
  const user = createServerData$(async (_, { request }) => {
    return {
      Foo: "Bar",
    };
  });

  return user;
}

export default function HeaderLayout() {
  const user = useRouteData<typeof routeData>();
  console.log("Test: ", user);
....
Was this page helpful?