Skip to content

Interdependent containers and asynchronous operations  #80

Open
@djMax

Description

@djMax

I'm trying to implement unstated-next in a React Native app and having some conceptual struggles. I have three containers - LocationContainer (stores the current location, as available), IdentityContainer (holds some GUIDs that are generated asynchronously) and SessionContainer (stores the result of a network call that is based on location and the GUIDs).

The first two are fairly easy, I just have useEffect functions with no dependencies to kick off the requests to generate guids or ask for location. In the SessionContainer I have a "status" value which says whether I've kicked off the request, received an answer, etc. The problem is I can't start the request in SessionContainer until the other two containers have particular state values. How do I "await" a state value in another container? Is there something inherently wrong with this container interdependence?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions