2021-03-25 07:05:25 +00:00
|
|
|
import { makeObservable, observable, action } from 'mobx';
|
|
|
|
import { observer } from 'mobx-react';
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
@observer class Index extends React.Component {
|
|
|
|
@observable x: number = 0;
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
clickMe() {
|
|
|
|
this.x += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<button onClick={this.clickMe.bind(this)}>{this.x}</button>
|
|
|
|
);
|
|
|
|
}
|
2021-03-25 05:04:09 +00:00
|
|
|
}
|
2021-03-25 07:05:25 +00:00
|
|
|
|
2021-03-25 05:04:09 +00:00
|
|
|
export default Index;
|