score:0

import React, { Component } from "react";

class Logic extends Component {

constructor(){
   this.state={
   value:""
   }

handleIncrement(value)
{
this.setState({
   value:value
             });
}

    render(){
    var Value="¬";
    return(
    <div>
    The value is: {this.state.value}
   
       <button>
        onClick={()=>{this.handleIncrement(Value)}}
        className={"btn btn-primary btn-sm m-2 p-1"}>
        {Value}
       </button>

    </div>);
    }
 }

score:1

import React from "react";
import "./styles.css";

class App extends React.Component {
  state = {
    value: ""
  };

  handleChange = e => {
    this.setState({ value: e.target.value });
  };
  plusOnClick = () => {
    this.setState(state => ({
      value: state.value + "+"
    }));
  };

  render() {
    return (
      <div className="App">
        <input
          type="text"
          onChange={this.handleChange}
          value={this.state.value}
        />
        <button onClick={this.plusOnClick}>+</button>
      </div>
    );
  }
}

export default App;

Related Query

More Query from same tag