0.2.0 • Published 4 years ago

use-ky v0.2.0

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

use-ky

Fetch-like hook using Ky.

Installation

yarn add use-ky

Usage

import { useKy } from 'use-ky'

function MyComponent() {
  const state = useKy(
    'https://example.com', { method: 'post', body: { json: { foo: true } } },
    (response) => response.json<ResponseFormat>()
  )

  console.log(state)
  // => { loading: true, data: null, error: null }
  // => { loading: true, data: '🦄', error: null }
}
0.2.0

4 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago