1.0.3 • Published 3 years ago
with-api v1.0.3
with-api
Made with create-react-library
Install
npm install --save with-api
Usage
import React from 'react'
import axios from 'axios'
import { WithApi } from 'with-api'
const getFake = () => axios.get('https://jsonplaceholder.typicode.com/todos/1');
const App = () => {
const [{ data, error, status, isLoading, reset }, fetchSomething] = WithApi(
getFake
)
React.useEffect(() => {
fetchSomething()
}, [])
}
export default App
License
MIT © 1997roylee