Skip to content

Idea: Use 2 mailboxes/addresses/action types #2

Open
@slorber

Description

@slorber

Use 2 mailboxes/addresses/action types...

NewGif component has a local state, but sometimes something that happens inside this component should trigger local changes but also changes in other places of the app.

Nested actions of Elm works really great for local state, but it's hard to listen for NEW_GIF actions in other components as they are nested.

In Flux/Redux, actions are not nested, so you can easily listen for NEW_GIF actions from anywhere, but it's hard to manage a bunch of nested NewGif components without the ceremony of having to assign each of them an UUID, creating a collection/store/reducer for a list of NewGif components... Many will use this.setState() with React and only dispatch NEW_GIF when needed because it is more easy to manage.

I think we can work on combining these 2 approachs together. Decoupled components could only dispatch local actions that only themselves are aware of, and then a layer above it couple these decoupled components to our app by propagating the local event above the stack (nested event), AND dispatching a global application event (flat event).

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