Simple and powerful API client for react 👍 Use hooks or FACCs to fetch data in easy way. No dependencies! Just react under the hood.
#112
Fixes
Fixes
Improvements
Improvements
Action
in TS - more info here
Breaking changes
Fix
Features
useBulkMutation
hook #75 - thanks for @josejulioFeatures
Improvements
type UsersResponse = {
data: User[];
meta: any;
}
export const fetchUsersList: Action<UsersResponse> = {
method: 'GET',
endpoint: '/users',
};
and then you can skip type in component ie.
const { payload } = useQuery(fetchUsersList)
instead of
const { payload } = useQuery<UsersResponse>(fetchUsersList)
Breaking changes
MutateContext
and QueryContext
have been removed - it's easier to create own context in applicationAction
type is now response type, to extend base Action
(ie. to add some new params) you have to create type like that:import { Action as BaseAction } from 'react-fetching-library';
export type Action<T = any, K = { skipAuth?: boolean; }> = BaseAction<T, K>;