Closed sidyes closed 5 years ago
Just define a component getter within your class:
@Getter("getItemByUser", { namespace: "items" })
getItemByUser!: (user: User) => Item;
// public item: Item;
// public created(): void {
// this.item = this.getItemByUser(this.user);
//}
get item(): Item {
return this.getItemByUser(this.user);
}
Hi folks!
I still got one question regarding parameterized Getters. At the moment I have a parametrized getter like this in my component:
The problem now is that the item property does not get updated when something in the state (which is used by the getItemByUser getter) changes. So it just gets called once and that's it. How can I somehow "subscribe" to this? A property-style access getter automatically updates it value when something changes.
Can you help me out there?