Mark the root state as tracked, and all other properties derived from it using native getters will update automatically. This does not require Ember framework classes to be involved at all: it works equally well with any class:
import { tracked } from '@glimmer/tracking';
class User {
@tracked name = 'Jen Weber';
get nameParts() {
return this.name.split(' ');
}
@action changeName(newName) {
this.name = newName;
}
}
get
get
is required when interoperating with code which does not yet use @tracked
. As a reasonable guide, then:
The rules for when get/set might still be required. (This needs some embellishment probably, but it's not written down anywhere, so this is as good a place to start as any!)
https://twitter.com/wycats/status/1240329993239924736?s=20
https://twitter.com/pzuraq/status/1240338123726315521
set