0.2.2 • Published 4 years ago

@peajs/rest v0.2.2

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

@peajs/rest

Installation

npm i @peajs/rest

Usage

import React from 'react'
import { useFetch } from '@peajs/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

demo:

Edit fetch-data-with-dahlia

License

MIT License

0.2.2

4 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago