react-haiku icon indicating copy to clipboard operation
react-haiku copied to clipboard

Feat: added useFetch hook

Open inevitableDivu opened this issue 2 years ago • 1 comments

Hey @m10rten, Can you please review this PR.

  • [x] The useFetch hook should be able to make HTTP requests and retrieve data from a specified URL.
  • [x] The hook should provide a way to specify the HTTP method (GET, POST, PUT, DELETE, etc.) for the request.
  • [x] The hook should handle loading and error states appropriately during the HTTP request.
  • [x] When the request is successful, the hook should provide the retrieved data to the component using it.
  • [x] The hook should support passing headers and body data for requests that require additional parameters.
  • [x] It should handle the cancellation of ongoing requests if the component using the hook is unmounted.
  • [ ] The hook should allow for customization of the request behavior, such as setting timeouts or handling redirects.
  • [x] It should provide a way to manually trigger the request, in addition to automatically triggering it on the component mount.
  • [ ] The hook should support handling multiple concurrent requests independently.
  • [ ] It should allow for customization of error handling, such as handling specific HTTP error codes differently.

inevitableDivu avatar Jul 30 '23 05:07 inevitableDivu

Seems someone already created a PR for this: #52

m10rten avatar Jul 31 '23 07:07 m10rten