Client Config
Configure the GraphQL client with links for networking, caching, and custom behavior.
Basic Configuration
Create a client with at least one terminating link (like httpLink
):
typescript
// src/lib/graphql-client.ts
import { createClient, httpLink } from 'mearie';
export const client = createClient({
links: [
httpLink({
url: 'https://api.example.com/graphql',
}),
],
});
Recommended Configuration
Add caching and deduplication for production use:
typescript
import { createClient, httpLink, cacheLink, dedupLink } from 'mearie';
export const client = createClient({
links: [
dedupLink(),
cacheLink(),
httpLink({
url: 'https://api.example.com/graphql',
}),
],
});
Next Steps
- Links Guide - Learn how links work
- HTTP Link - Configure HTTP transport
- Cache Link - Configure caching
- Custom Links - Create custom middleware