import React from 'react' import DemoEditSecondary from './DemoEditSecondary' class DemoEditPrimary extends React.Component { constructor () { super() this.handleChange = this.handleChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) } handleChange (event) { const { actions } = this.props const { id, name, value } = event.target const passedValue = (name === 'active') ? (value === 'active') : value actions.updatePrimary(id, {[name]: passedValue}) } handleSubmit (event) { event.preventDefault() // Save values in database. } render () { const { primary } = this.props return (
{ this.name = input }} value={primary.name} onChange={this.handleChange} />
{primary.secondary.map((secondary, key) => ( ))}
) } } export default DemoEditPrimary