Skip to content

when observable object in mobx v5 by function, how to computed structural? #3362

Answered by urugator
youtiao66 asked this question in Q&A
Discussion options

You must be logged in to vote
const store = observable({
  get outerList2() {
    return this.list;
  }
}, { 
 outerList2: computed.struct 
})

or

const store = observable({
  _outerList2: computed(() => store.list, { equals: comparer.structural }),
  get outerList2() {
    return this._outerList2.get();   	
  }
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@youtiao66
Comment options

Answer selected by kubk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants