UNPKG

@ts-rest/react-query

Version:

react-query client integration for @ts-rest

15 lines (12 loc) 469 B
"use client"; import * as React from 'react'; import { createContext } from 'react'; const TsrQueryClientContext = createContext(undefined); const useTsrQueryClient = () => { const tsrQueryClient = React.useContext(TsrQueryClientContext); if (!tsrQueryClient) { throw new Error('tsrQueryClient not initialized. Use TsRestReactQueryProvider to initialize one.'); } return tsrQueryClient; }; export { TsrQueryClientContext, useTsrQueryClient };