Just getting started with Mobx & React and having trouble getting the store to update. I get error when clicking the button, which should update the \'me\' property:
<
As @Sulthan mentioned, you need to have the method wrapped by another function onClick={()=>store.changeMe()}
.
Second issue is you are missing action
decorator for the method which updating the value. Mobx works in a way where every method which will update properties, it need to be decorated by @action
. So following will fix the issue import {action} from 'mobx
,
@action change_me(){
this.me = 'test 1';
}