Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: fix example code in UrqlProvider tsdoc. (#3748)

Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>

authored by

Yukihiro Hasegawa
Jovi De Croock
and committed by
GitHub
dbc7a5b8 128a0888

+22 -11
+6
.changeset/beige-penguins-complain.md
··· 1 + --- 2 + '@urql/next': patch 3 + --- 4 + 5 + Update Provider TSDoc to reflect our advice on 6 + instantiating the client within a React component.
+16 -11
packages/next-urql/src/Provider.ts
··· 18 18 * 19 19 * @example 20 20 * ```tsx 21 + * import { useMemo } from 'react'; 21 22 * import { 22 23 * UrqlProvider, 23 24 * ssrExchange, ··· 26 27 * createClient, 27 28 * } from '@urql/next'; 28 29 * 29 - * const ssr = ssrExchange(); 30 - * const client = createClient({ 31 - * url: 'https://trygql.formidable.dev/graphql/basic-pokedex', 32 - * exchanges: [cacheExchange, ssr, fetchExchange], 33 - * suspense: true, 34 - * }); 30 + * export default function Layout({ children }: React.PropsWithChildren) { 31 + * const [client, ssr] = useMemo(() => { 32 + * const ssr = ssrExchange(); 33 + * const client = createClient({ 34 + * url: 'https://trygql.formidable.dev/graphql/web-collections', 35 + * exchanges: [cacheExchange, ssr, fetchExchange], 36 + * suspense: true, 37 + * }); 38 + * 39 + * return [client, ssr]; 40 + * }, []); 35 41 * 36 - * export default function Layout({ children }: React.PropsWithChildren) { 37 - * return ( 38 - * <UrqlProvider client={client} ssr={ssr}> 42 + * return ( 43 + * <UrqlProvider client={client} ssr={ssr}> 39 44 * {children} 40 - * </UrqlProvider> 41 - * ); 45 + * </UrqlProvider> 46 + * ); 42 47 * } 43 48 * 44 49 * ```