Skip to content

Use react-query or swr instead of useEffect and useState for async data fetching #276

@AdamFipke

Description

@AdamFipke

Description

see https://react.dev/learn/you-might-not-need-an-effect#fetching-data

Technically we can just make our own hook that does stuff like deduplication and stuff for us, but it's probably better to use the package that's specifically built for this purpose.

react-query is the more popular choice, though our project already has the swr package (which I think will allow us to make regular fetch calls with it).

Basically, you have to go through the whole system and find all queries that set states and instead use swr or react-query. This will help reduce a lot of code and solve bugs and probably help a bunch of other things

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