import React, { Component } from 'react' export class Form extends Component { constructor(props) { super(props) this.state = { tolStart: 0.1, tolStep: 0.1, tolEnd: 1, highQual: true, chart: 'wasmVsJs', benchMethod: 'iteration', iterations: 10, timeToRun: 200 } this.handleInputChange = this.handleInputChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) this.props.onFormChange(this.state) } handleSubmit(event) { event.preventDefault() this.props.onFormSubmit() } handleInputChange(event) { let name, value const target = event.target value = target.type === 'checkbox' ? target.checked : target.value value = target.type === 'number' ? Number(value) : value value = target.type === 'range' ? Number(value) : value name = target.name this.setState({ [name]: value }) this.props.onFormChange({ ...this.state, [name]: value }) } render() { return (