heroku / heroku/react-refetch

[idea] useRefetch

Open
#218 5 comments 8 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
137
PR merge metrics
No merged PRs in 30d

Description

Would be really cool if the classical react-refetch API could be extrapolated into the React Hooks style syntax. Here's what I've cooked up so far: https://codesandbox.io/s/52j3760v4n

Basically you'd need to record two different types of hooks, one for synchronous hooks that fire immediately/always and one for async hooks that require a function to be executed. I've used a simple queue in the example but it could just as well work by overwriting a single "last request" and then using the `useEffects` comparing array to run a comparing function (like the default refetch comparing function for instance)

Either way I think there's a decent amount of potential in it. What do you all think?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.