Skip to content

[idea] useRefetch #218

Open
Open
@horyd

Description

@horyd

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions