Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Preact bindings for urql
TypeScript JavaScript HTML
Branch: master
Clone or download
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create FUNDING.yml Jan 11, 2020
example complete example Jan 5, 2020
scripts infrastructure Jan 5, 2020
src Update Subscription.test.tsx Jan 11, 2020
.codecov.yml infrastructure Jan 5, 2020
.editorconfig init repo Jan 3, 2020
.eslintignore init repo Jan 3, 2020
.eslintrc.json remove react specific linting Jan 5, 2020
.gitignore infrastructure Jan 5, 2020
.npmignore infrastructure Jan 5, 2020
.travis.yml don't typecheck in travis Jan 5, 2020
CHANGELOG.md 1.1.0 Jan 11, 2020
LICENSE Initial commit Jan 3, 2020
README.md move to new travis location Jan 20, 2020
package.json 1.1.0 Jan 11, 2020
rollup.config.js add filesize reporting Jan 5, 2020
tsconfig.json prepare for release Jan 5, 2020
yarn.lock 1.1.0 Jan 11, 2020

README.md

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>);
};
You can’t perform that action at this time.