freshpack
Version:
Command line scaffolding tool for react apps
38 lines (31 loc) • 790 B
JavaScript
// @flow
/* eslint
no-unused-vars: 0
react/no-multi-comp: 0
*/
import React from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import type { CounterType } from './types';
import './style.css';
type Props = {
counter: CounterType
};
class App extends React.Component {
props: Props;
render() {
return (
<div className="center-wrapper">
<h2>{ this.props.counter.value }</h2>
<button onClick={ () => this.props.counter.increase() }>+</button>{' '}
<button onClick={ () => this.props.counter.decrease() }>-</button>{' '}
<button onClick={ () => this.props.counter.double() }>double</button>
</div>
);
}
}
App.propTypes = {
counter: PropTypes.object
};
export default App;