I use MobX and React in my client-side code like this:
<script src="/js/react.min.js"></script>
<script src="/js/react-dom.min.js"></script>
<script src="/js/mobx.umd.js"></script>
<script src="/js/mobx-react/index.min.js"></script>
Now When I want to actually use MobX like below, it doesn't work, i.e. my client-side user-interface doesn't react to changes of observable variables:
const action=window.mobx.action
const observable=window.mobx.observable
class Store {
@observable isLoggedIn=false;
@action setIsLoggedIn=(tf)=>{this.isLoggedIn=tf}
}
I wonder how I can actually use "window.mobx.action" and "window.mobx.observable" with ES6.
Previously I was using MobX with NPM like below, and it was working fine:
import { action, observable } from 'mobx'
via user7312233
No comments:
Post a Comment