📜  输入计数 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:49.697000             🧑  作者: Mango

代码示例1
import React from "react";
import Button from "@material-ui/core/Button";
import ButtonGroup from "@material-ui/core/ButtonGroup";

class GroupedButtons extends React.Component {
  state = { counter: 0 };

  handleIncrement = () => {
    this.setState(state => ({ counter: state.counter + 1 }));
  };

  handleDecrement = () => {
    this.setState(state => ({ counter: state.counter - 1 }));
  };
  render() {
    const displayCounter = this.state.counter > 0;

    return (
      
        
        {displayCounter && }
        {displayCounter && }
      
    );
  }
}

export default GroupedButtons;