0.20.2 • Published 3 years ago

@vulppi/react-use-fetch v0.20.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

useFetch

const Component: React.FC = (props, ref) => {

  const { data, textData, error, loading, reRequest } = useFetch<any>(
    'http://localhost:3000/api/demo',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json', // is default
      }
      bearerToken: '12345', // becomes Authorization: Bearer 12345
      basicAuth: '12345', // becomes Authorization: Basic 12345
      token: '12345', // becomes Authorization: 12345
      block: false, // is default
      dependencies: [], // is default
      body: JSON.stringify({
        name: 'John Doe',
        age: 30,
      }),
    },
  )

  return <></>
}
0.20.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago