Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

view model #180

Open
hyusetiawan opened this issue May 10, 2020 · 0 comments
Open

view model #180

hyusetiawan opened this issue May 10, 2020 · 0 comments

Comments

@hyusetiawan
Copy link

hyusetiawan commented May 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant