Skip to content

view model #180

@hyusetiawan

Description

@hyusetiawan

Is your feature request related to a problem? Please describe.
I want to have a component that mutates the state locally with validation in a transactional manner. For example, I have a user object:

store({
    name: 'my name',
    address: {
       street: 'some avenue',
       city: 'some city',
    }
})

The UI will have a modal dialog for address that will get it as a prop and will only "commit" to the store if address is valid.

<AddressDialog address={address} onChange={(validNewAddress) => store.address = validNewAddress}  onCancel={() => ???} />

Describe the solution you'd like
Very similar to https://github.com/mobxjs/mobx-utils#viewmodel

Describe alternatives you've considered or seen elsewhere
none

Additional context
none

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