Skip to content

Hooks

Pre-release
Pre-release
Compare
Choose a tag to compare
@parkerziegler parkerziegler released this 07 Jul 01:52

This release includes support for urql hooks, including useQuery, useMutation, and useSubscription. It also includes additions to support proper type inference of GraphQL requests, such that users get compile-time guarantees that they are accessing data in a fully type-safe way.

Added

  • Bindings for useQuery, useMutation, and useSubscription.
  • Bindings for SubscriptionWithHandler, which is to be used in cases where a custom handler function is passed to the Subscription component to accumulate subscriptions.
  • The top-level urql context object, which exposes a Consumer and Provider, is now exposed to the user.

Changed

  • Migrated all components and examples to latest ReasonReact syntax ("jsx: 3").
  • Add proper type inference for hooks and components. This is achieved by passing the entire graphql_ppx module to the hooks, which allows them to use the parse method to infer the return type of data from the request.