hally9k-apollo-hooks-extended

Library of additional hooks and wrappers for Apollo Client

Usage no npm install needed!

<script type="module">
  import hally9kApolloHooksExtended from 'https://cdn.skypack.dev/hally9k-apollo-hooks-extended';
</script>

README

Apollo Hooks Extended

Build Status Coverage Status NPM version MIT License

Let's start with big kudos for the authors and maintainers of Apollo, fantastic work :)

This package is a complementary library providing additional features for @apollo/client.

Installation

Using Yarn:

$ yarn add apollo-hooks-extended

# or
$ yarn add apollo-hooks-extended

Using Npm:

$ npm install apollo-hooks-extended

# or
$ npm i apollo-hooks-extended

Features

Resettable Hook

It is not currently possible to reset the state returned by the useMutation hook.

useResettableMutation is a swap in replacement which wraps useMutation and provides a reset function.

import {useResettableMutation} from 'apollo-hooks-extended';
// ...
const [performMutation, {data, loading, error, reset}] = useResettableMutation(query);