Client entry

The main client-side entry point of a Rakkas application is the src/entry-client.js (or .ts, .jsx, .tsx) file. Rakkas has a default implementation, so you don't have to provide one. But it exposes advanced customization features that you might find useful. If provided, it should call the startClient function from the rakkasjs/client module to start the client.

import { startClient } from "rakkasjs/client";

startClient({
  hooks: {
    beforeStart() {
      // Do something before starting the client
    },
    extendPageContext(ctx) {
      // Add properties to the page context,
      // especially to ctx.locals.
      // Extensions added here will only be
      // available on the client-side.
    },
    wrapApp(app) {
      // Wrap the Rakkas application in some provider
      // component (only on the client).
      return <SomeProvider>{app}</SomeProvider>;
    },
  },
  defaultQueryOptions: {
    // Global defaults for `useQuery` options
  },
});