dahlia-rest
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

dahlia-rest

Installation

yarn add dahlia-rest

Usage

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

Readme

Keywords

none

Package Sidebar

Install

npm i dahlia-rest

Weekly Downloads

8

Version

1.3.0

License

MIT

Unpacked Size

29.2 kB

Total Files

14

Last publish

Collaborators

  • forsigner