naystack - v1.5.10
    Preparing search index...

    Function ApolloWrapper

    • Apollo Client provider for Next.js. Wrap your app (or a subtree) so client components can run GraphQL queries and mutations. The GraphQL endpoint is read from NEXT_PUBLIC_GRAPHQL_ENDPOINT env var.

      Must be placed inside AuthWrapper (since useAuthQuery / useAuthMutation depend on the auth token).

      Parameters

      • props: PropsWithChildren<{ cacheConfig?: InMemoryCacheConfig }>

        Component props.

        • children

          React children (your app or page content).

        • cacheConfig

          Optional InMemoryCache config (e.g. typePolicies, addTypename). Passed to Apollo's InMemoryCache.

      Returns Element

      Provider component that supplies Apollo Client to the tree.

      // app/layout.tsx
      import { AuthWrapper } from "naystack/auth/client";
      import { ApolloWrapper } from "naystack/graphql/client";

      export default function RootLayout({ children }: { children: React.ReactNode }) {
      return (
      <html lang="en">
      <body>
      <AuthWrapper>
      <ApolloWrapper>{children}</ApolloWrapper>
      </AuthWrapper>
      </body>
      </html>
      );
      }