JSORM the isomorphic, framework-agnostic Javascript ORM
Data Down, Actions Up
It’s a popular pattern to pass data down to components, avoid modifying state within the component, and instead pass actions up to modify state. This can make complex applications easier to track and reason about, and you’ll see it in client-side frameworks from React to Ember.
To follow this pattern, use #dup()
when passing down to your component:
This will create a new instance of the model with all the same state. Avoid modifying this instance in your component and instead pass actions up.
When opting-in to state-syncing these instances will sync-up whenever one of these is instances is persisted. You won’t have to worry about updating the child component when the parent instance is saved.