easy-fix
easy-fix copied to clipboard
[FEATURE] Improve use-fetch hook
Description
The following hook is not very versatile. I would improve the API to the following:
- It would take in a function that returns a promise () => Promise<T>
- A reducer would be used to avoid state unnecessary batching
- The return value would be the following:
data: T | null
,error: RequestError
(will be defined as a model),status: RequestStatus
(will be defined as a model),isLoading: boolean
,hasError: boolean
, `run: () => Promise
The API might change, I will keep this issue updated.
Screenshots
No response
✨ Browser
Google Chrome
Checklist 🚀
- [X] I checked and didn't find similar issue
- [X] I have read the Contributing Guidelines
- [X] I am willing to work on this issue (blank for no).