Skip to content

Store (atom) composition #3

@rankun203

Description

@rankun203

We are trying to use the same API response (piece of data) in different components. So we are putting API response data & metadata into a store. Basically trying to mimic React Query / SWR

Is there a way to do store composition? For example

const productsResp = atom({
  data: atom([]),
  isLoading: atom(false),
  isError: atom(false),
  isSuccess: atom(true),
});

So we can conditionally render different components with these state and don't have to pass all API loading states around.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions