Skip to content

[Question]: Mixing global and local state #222

@hffmnn

Description

@hffmnn

Using the StoreConnector it looks to me like all of the view models properties must be derived from the current store data. But what if I want to have some data that should be kept local to the view. Let's say I want to e.g. show an alert once based on an exception that is part of the redux state. For this, I would have a property like showedExceptionAlert in the view model. But whenever the view model gets regenerated the value of this property would get overridden. And I don't want to go the full redux way via actions, reducer... just because of a simple, local-only property.

For sure I could keep this data in the view, but that feels a little bit wrong to have two places to look for the current state.

Another option would be to mix e.g. the bloc pattern with redux but this also seems a little bit too much for such a simple task.

So the question is: Is there something like a pattern to have local and global (redux) state in one view model?

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