Component props.
React children (your app or page content).
Optional InMemoryCache config (e.g. typePolicies, addTypename). Passed to Apollo's InMemoryCache.
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>
);
}
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_ENDPOINTenv var.Must be placed inside
AuthWrapper(sinceuseAuthQuery/useAuthMutationdepend on the auth token).