import * as React from 'react'; import PropsTypes from './types'; interface State { show: boolean } export default class Button extends React.Component { constructor(props: PropsTypes, public state: State) { super(props); this.state = { show: this.props.show } } componentWillReceiveProps(props) { if (props.show !== this.props.show) { this.setState({ show: !this.state.show }) } } showHide() { this.setState({ show: !this.state.show }) } public render(): JSX.Element { const {show} = this.state; const {title, footer, children, position,size} = this.props; return (

{title}

this.showHide()} />
{children}
); } }