SwitcherItem.jsx 361 B

123456789101112131415161718
  1. import {Component} from 'react';
  2. import Button from './Button';
  3. export default class SwitcherItem extends Component {
  4. handleClick = () => {
  5. this.props.onClick(this.props.item);
  6. };
  7. render() {
  8. const {item, ...props} = this.props;
  9. return (
  10. <Button {...props} onClick={this.handleClick}>
  11. {item.label}
  12. </Button>
  13. );
  14. }
  15. }