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 and QueryContext have been removed - it's easier to create own context in application
    • First parameter for Action 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>;