@fishx/rest
v3.0.0
Published
Restful client for fishx
Downloads
121
Readme
@fishx/rest
Installation
yarn add @fishx/rest
Usage
import React from 'react'
import { useFetch } from '@fishx/rest'
const Todos = () => {
const { loading, data, error } = useFetch(
'https://jsonplaceholder.typicode.com/todos',
)
if (loading) return <span>loading...</span>
if (error) return <span>error!</span>
return (
<ul>
{data.map(item => (
<li key={item.id}>{item.title}</li>
))}
</ul>
)
}
export defulat Todos