React Fetching Library Versions Save

Simple and powerful API client for react 👍 Use hooks or FACCs to fetch data in easy way. No dependencies! Just react under the hood.

1.7.6

3 years ago

#112

1.7.5

3 years ago
  • Reset payload in useQuery when re-rendered with changed query -#110

1.7.4

4 years ago

Fixes

  • #84 - handleReload from useQuery hook fired with old client instance after client update

1.7.3

4 years ago

Fixes

  • #84 - queries were fired with old client instance after client update

1.7.1

4 years ago

Improvements

  • Allow to easily use axios with all features - example

1.7.0

4 years ago

Improvements

  • New way of extending base Action in TS - more info here

Breaking changes

  • Old way of extending Action type in TS is not working anymore

1.6.4

4 years ago

Fix

  • TS types of client context

1.6.2

4 years ago

Features

1.6.1

4 years ago

Features

1.6.0

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>;