Sha256: db054499e4278342ab63597d6176fa6503695af78e4bf2e7da2bf14c8fda5b11

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

import React from 'react'
import neutron from 'neutron'

export default class Sum extends React.Component {

  constructor(props) {
    super(props)
    this.state = {}
  }

  sum() {
    const a = parseInt(this.a.value)
    const b = parseInt(this.b.value)
    neutron.send('add', [a, b]).then((result) => {
      this.setState({result: result})
    }).catch((error) => {
      console.log(error)
    })
  }

  render() {
    return(
      <div>
        <p>
          <input ref={(input) => this.a = input}/>
          +
          <input ref={(input) => this.b = input}/>
          = {this.state.result}
        </p>
        <p>
          <button onClick={this.sum.bind(this)}>Calculate</button>
        </p>
      </div>
    )
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neutron-ruby-electron-0.1.2 lib/neutron/template/src/assets/javascripts/components/sum.js
neutron-ruby-electron-0.1.1 lib/neutron/template/src/assets/javascripts/components/sum.js
neutron-ruby-electron-0.1.0 lib/neutron/template/src/assets/javascripts/components/sum.js