File tree Expand file tree Collapse file tree 1 file changed +21
-23
lines changed Expand file tree Collapse file tree 1 file changed +21
-23
lines changed Original file line number Diff line number Diff line change 11import PropTypes from 'prop-types' ;
22import React from 'react' ;
33
4- class Button extends React . PureComponent {
5- static propTypes = {
6- children : PropTypes . node . isRequired ,
7- title : PropTypes . string ,
8- } ;
4+ const propTypes = {
5+ children : PropTypes . node . isRequired ,
6+ title : PropTypes . string ,
7+ } ;
8+ const defaultProps = {
9+ title : null ,
10+ } ;
911
10- static defaultProps = {
11- title : null ,
12- } ;
13-
14- render ( ) {
15- const { children, title, ...props } = this . props ;
16-
17- return (
18- < button
19- aria-label = { title }
20- title = { title }
21- type = "button"
22- { ...props }
23- >
24- { children }
25- </ button >
26- ) ;
27- }
12+ function Button ( { children, title, ...props } ) {
13+ return (
14+ < button
15+ aria-label = { title }
16+ title = { title }
17+ type = "button"
18+ { ...props }
19+ >
20+ { children }
21+ </ button >
22+ ) ;
2823}
2924
25+ Button . propTypes = propTypes ;
26+ Button . defaultProps = defaultProps ;
27+
3028export default Button ;
You can’t perform that action at this time.
0 commit comments