Changing and reverting
Now we can style our edit form. Let's replace the modification indicator (asterisk) with a button that will simulate the save action:
constructor(props) { super(props); this.state = { "changed": false }; this.bind( "onCancel", "onSave", "onUpdate", ); } render() { var cancelButtonStyle = null; var saveButton = null; if (this.state.changed) { cancelButtonStyle = this.props.cancelButtonStyle || { "margin": "0 0 0 10px" }; saveButton = <button onClick={this.onCancel}> save </button> } return <form> <div> <input type="text" onChange={this.onUpdate} name="title" value={this.props.title} /> </div> ...