UNPKG

790 BJavaScriptView Raw
1// @flow
2/* eslint
3 no-unused-vars: 0
4 react/no-multi-comp: 0
5*/
6import React from 'react';
7import PropTypes from 'prop-types';
8import { observer } from 'mobx-react';
9import type { CounterType } from './types';
10
11import './style.css';
12
13type Props = {
14 counter: CounterType
15};
16
17@observer
18class App extends React.Component {
19 props: Props;
20
21 render() {
22 return (
23 <div className="center-wrapper">
24 <h2>{ this.props.counter.value }</h2>
25 <button onClick={ () => this.props.counter.increase() }>+</button>{' '}
26 <button onClick={ () => this.props.counter.decrease() }>-</button>{' '}
27 <button onClick={ () => this.props.counter.double() }>double</button>
28 </div>
29 );
30 }
31}
32
33App.propTypes = {
34 counter: PropTypes.object
35};
36
37export default App;