From 91ecdaa5dd1a65ff0ae944896945c0fe4bc23574 Mon Sep 17 00:00:00 2001 From: haishanh Date: Mon, 5 Nov 2018 18:32:16 +0800 Subject: update: convert more components to function ones includes Input, Config, SideBard. also removed react-redux Provider --- src/components/Button.js | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/components/Button.js') diff --git a/src/components/Button.js b/src/components/Button.js index 34fe5fe..eb50ffd 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -1,25 +1,20 @@ -import React, { Component } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import s0 from 'c/Button.module.scss'; +const noop = () => {}; -class Button extends Component { - static propTypes = { - label: PropTypes.string.isRequired, - onClick: PropTypes.func - }; +const Button = React.memo(function Button({ label, onClick = noop }) { + return ( + + ); +}); - static defaultProps = { - onClick: () => {} - }; - - render() { - return ( - - ); - } -} +Button.propTypes = { + label: PropTypes.string.isRequired, + onClick: PropTypes.func +}; export default Button; -- cgit v1.3.1