If I re-write the example in the Views section of the MST's README file, but using a normal function without arguments instead of a getter, will it still be treated as a computed value with same benefits as using a getter?
const UserStore = types
.model({
users: types.array(User)
})
.views(self => ({
// vs. 'get amountOfChildren()'...
getAmountOfChildren() {
return self.users.filter(user => user.age < 18).length
},
}))
Sorry I'm sure this is a dumb question - it's just for some reason I've never liked those getters too much, and I'm trying FlowType and it doesn't seem to like them either...
No it won't, usually functions accept parameters, and getters does'nt. that's why getters can be memoized if watched by a reaction, and function without args no :)