import { DataProviderProxy } from '../types';
/**
* Hook for getting a dataProvider
*
* Gets a dataProvider object, which behaves just like the real dataProvider
* (same methods returning a Promise). But it's actually a Proxy object, which
* dispatches Redux actions along the process. The benefit is that ../../app
* tracks the loading state when using this hook, and stores results in the
* Redux store for future use.
*
* In addition to the 2 usual parameters of the dataProvider methods (resource,
* payload), the Proxy supports a third parameter for every call. It's an
* object literal which may contain side effects, or make the action optimistic
* (with mutationMode: optimistic) or undoable (with mutationMode: undoable).
*
* @return dataProvider
*
* @example Basic usage
*
* import * as React from 'react';
* import { useState } from 'react';
* import { useDataProvider } from '../app';
*
* const PostList = () => {
* const [posts, setPosts] = useState([])
* const dataProvider = useDataProvider();
* useEffect(() => {
* dataProvider.getList('posts', { filter: { status: 'pending' }})
* .then(({ data }) => setPosts(data));
* }, [])
*
* return (
*