The calculator on React.js

The calculator on React.js
0.0 0

#1

Hello everybody.

I have some questions(problems :slight_smile:) with building my Calculator on React.js. Frequently I don’t have access to internet (That’s why it is difficult to use chats for answers) and I will post my questions here.

I hope that questions and answers will help other people except me! :relaxed:


#2

I have a code and need to make Buttons’ onClick event change the state of InputField?

var InputField = React.createClass({
  getInitialState: function(){
    return {field:' '}
  },
  render: function(){
    return <h1>{this.state.field}</h1>
  }
})

var Buttons = React.createClass({
  handleClick: function(value){
    return InputField.state.field += val;
  },
  render: function(){
    let count = 1;
    var boundClick = this.handleClick;
    return (<ul>{
      buttonValues.map(function(val){
        return <button key={count++} onClick={boundClick}>{val}</button>
      })} </ul>
    )
  }
})