Skip to content

v3.0.6

Compare
Choose a tag to compare
@danybeltran danybeltran released this 08 Oct 20:01
· 101 commits to master since this release
6c8b313

Adds the useManualFetch hook, which makes a fetch only when triggered manually

Example:

import { useManualFetch, serialize } from 'http-react'

export default function Home() {
  const { data, reFetch } = useManualFetch('https://jsonplaceholder.typicode.com/todos/3')

  return (
    <main>
      <button onClick={reFetch}>Request now</button>
      <hr />
      <pre>{serialize(data, null, 2)}</pre>
    </main>
  )
}

In this case, while the Request now button is not clicked, data will be undefined