commerce/components/preview-provider.tsx
2023-08-14 23:22:54 +02:00

17 lines
421 B
TypeScript

'use client';
import { getClient } from '@/lib/sanity/sanity.client';
import { LiveQueryProvider } from '@sanity/preview-kit';
import { useMemo } from 'react';
export default function PreviewProvider({
children,
token
}: {
children: React.ReactNode;
token: string;
}) {
const client = useMemo(() => getClient({ token }), [token]);
return <LiveQueryProvider client={client}>{children}</LiveQueryProvider>;
}