@zquery/zquery
v0.0.1
Published
Using server state in zustand
Readme
The ZQuery middleware efficiently manages complex asynchronous functions.
useZQuery(key, queryFn, options)
Parameters
key: A key name to distinguish fetched data. This key must be in the form of an array.queryFn: A function that calls data from the server.options: An object to define query options.- optional
staleTime: Time before the data staled. - optional
retry: Not yet. - optional
enable: Not yet.
- optional
Returns
useZQuery: Return the data and its state.data: Returns the data received from the server.isLoading: Returns the state during data fetching.error: Returns details when an error occurs.
Usage
First, make a query statement
Then, while your data is fresh, you can always use it without fetch.
