react-fetching-library v1.6.0 Release Notes
Release Date: 2020-02-20 // about 4 years ago-
Improvements
- ๐ฆ package size reduction (replace tsc with rollup and closure compiler)
๐ allow to define response TS type directly in action definition
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
andQueryContext
have been removed - it's easier to create own context in application First parameter for
Action
type is now response type, to extend baseAction
(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>;