Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const CreateViewModelExample = asComponent(() => {
class FormData {
@observable name = '';
@observable email = '';
@observable favoriteColor = '';
}
const viewModel = createViewModel(new FormData());
autorun(() => {
console.log(
`ViewModel: ${viewModel.name}, Model: ${
viewModel.model.name
}, Dirty: ${viewModel.isDirty}`,
);
});
viewModel.name = 'Pavan';
viewModel.email = 'pavan@pixelingene.com';
viewModel.favoriteColor = 'orange';
console.log('About to reset...');
viewModel.reset();