Miss any of our Open RFC calls?Watch the recordings here! »

@urql/preact

1.2.1 • Public • Published

Installation

yarn add @urql/preact urql graphql
# or 
npm install --save @urql/preact urql graphql

Usage

The usage is a 1:1 mapping of the React usage found here

small example:

import { createClient, defaultExchanges, Provider, useQuery } from '@urql/preact';
 
const client = createClient({
  url: 'https://myHost/graphql',
  exchanges: defaultExchanges,
});
 
const App = () => (
  <Provider value={client}>
    <Dogs />
  </Provider>
);
 
const Dogs = () => {
  const [result] = useQuery({
    query: `{ dogs { id name } }`,
  });
 
  if (result.fetching) return <p>Loading...</p>;
  if (result.error) return <p>Oh no...</p>;
 
  return result.data.dogs.map(dog => <p>{dog.name} is a good boy!</p>);
};

Install

npm i @urql/preact

DownloadsWeekly Downloads

165

Version

1.2.1

License

MIT

Unpacked Size

94 kB

Total Files

25

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar