easy-fix icon indicating copy to clipboard operation
easy-fix copied to clipboard

[FEATURE] Improve use-fetch hook

Open fekete965 opened this issue 1 year ago • 2 comments

Description

The following hook is not very versatile. I would improve the API to the following:

  1. It would take in a function that returns a promise () => Promise<T>
  2. A reducer would be used to avoid state unnecessary batching
  3. 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).

fekete965 avatar Oct 07 '23 14:10 fekete965