@teamkeel/client-react-query
TypeScript icon, indicating that this package has built-in type declarations

0.413.8 • Public • Published

@teamkeel/client-react-query

Create fully typed React-Query hooks from a generated Keel client.

Install

N.B. Requires @teamtkeel/client-react to be installed and setup first.

npm i @teamkeel/client-react-query

Usage

Create and export the useKeelQuery and useKeelMutation hooks by passing in a useKeel hook generated by the client-react package.

// Follow @teamtkeel/client-react setup instructions
import { APIClient } from "../keelClient";
import { keel } from "@teamkeel/client-react";

import { keelQuery } from "@teamkeel/client-react-query";

export const { KeelProvider, useKeel } = keel(APIClient);
export const { useKeelQuery, useKeelMutation } = keelQuery(useKeel);

You can then use these hooks in your components. Inputs are fully typed based on the action name.

const query = useKeelQuery("actionName", actionInputs, queryOptions);

const mutation = useKeelMutation("actionName", mutationOptions);

Readme

Keywords

none

Package Sidebar

Install

npm i @teamkeel/client-react-query

Weekly Downloads

135

Version

0.413.8

License

ASL (Apache 2.0)

Unpacked Size

8.69 kB

Total Files

6

Last publish

Collaborators

  • teamkeel