fetchStateReceiver

fetchStateReceiver was created to handle the data fetching process. Information about the data fetching process and fetch results are saved in the state selected by us.

This helper method is integrated with useFetchState hook.

import { fetchStateReceiver } from 'eventrix';
import axios from 'axios';

const fetchUsersListReceiver = fetchStateReceiver(
    'users',
    (fetchParams) => {
        return axios.get('http://domain.com/users', fetchParams)
                    .then(({data: usersList}) => {
                        return usersList;
                    });
    }
);

export default receiver;

Last updated