我有这个mobx并在codepen中做出反应设置,但装饰器语法似乎没有起作用:
https://codepen.io/swyx/pen/OvNmrR
任何我可能会出错的地方?它是一个非常简单的设置,我只是"只是"按照教程。
这里是懒惰的代码:
const {observable} = mobx;
const {observer, Provider} = mobxReact;
const {Component} = React;
const appState = new class {
@observable text = "k";
handleChange = e => this.text = e.target.value;
}
@observer(['store']) // this is erroring! why??
class Form extends Component {
render() {
const {handleChange} = this.props.store
return (
<div>
<input type="text" onChange={handleChange} />
</div>
)
}
}