Skip to content

mapStateToProps and mapDispatchToProps looks to me like a viewModel #321

@vladap

Description

@vladap

ViewModel maps model (state) into props for rendering and can include commands. It might be benefitial to keep established terminology. It might as well simplify API into a single function. I assume that viewModels are small hence the separation into two function is a boilerplate which could be reduced:

const viewModel = (state, dispatch) {
todos: state.todos,
onTodoClick: id => dispatch({...})
}

const TodoList = connect(viewModel)(TodoList)

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