A highly customizable and versatile GraphQL client for Preact
npm install @urql/preact``sh`
yarn add @urql/preact urql graphqlor
npm install --save @urql/preact urql graphql
The usage is a 1:1 mapping of the React usage found here
small example:
`jsx
import { createClient, cacheExchange, fetchExchange, Provider, useQuery } from '@urql/preact';
const client = createClient({
url: 'https://myHost/graphql',
exchanges: [cacheExchange, fetchExchange],
});
const App = () => (
);
const Dogs = () => {
const [result] = useQuery({
query: { dogs { id name } },
});
if (result.fetching) return
Loading...
;Oh no...
;return result.data.dogs.map(dog =>
{dog.name} is a good boy!
);