react-haiku
react-haiku copied to clipboard
Feat: added useFetch hook
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.
Seems someone already created a PR for this: #52