Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

Property in MobX is behaving weirdly

$
0
0

I am using Mobx in my react app.

Right now i have this property

    @observable  messages: IObservableArray<MessageModel> = observable.array();

and then i have a method that uses that property

 @computed  get AllMessages() {    console.log('GETTING ALL MESSAGES', this.messages);    const mostRecentReadMessage = this.getReadMessage();   return {... some code}}

The weird thing is, if log the content of this.messages i get the new messages values, but if i try to access it like this.messages[0].chat.text i get the old value.

Any help understanding this will be greatly appreciated.


Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>