import React, {PureComponent, PropTypes} from 'react'; import {shell} from 'electron'; class Button extends PureComponent { _handleClick = e => { const {onClick, onDisabledClick, disabled} = this.props; const fn = disabled ? onDisabledClick : onClick; if (this.props.hasOwnProperty('value')) { fn && fn(this.props.value, e); } else { fn && fn(e); } }; render () { const {children, value, ...props} = this.props; return ( ) } } Button.propTypes = { value: PropTypes.any, onDisabledClick: PropTypes.func, onClick: PropTypes.func, }; export default Button;