@fishx/rest
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @fishx/rest

Weekly Downloads

59

Version

3.0.0

License

MIT

Unpacked Size

116 kB

Total Files

30

Last publish

Collaborators

  • whalecloud-developer