import React from 'react'; import { Link } from 'react-router-dom'; class CommentForm extends React.Component { constructor(props) { super(props); this.state = props.comment; this.handleSubmit = this.handleSubmit.bind(this); this.handleChange = this.handleChange.bind(this); } handleChange(e) { this.setState({body: e.target.innerHTML}); } handleSubmit(e) { if ((/\S+/).test(this.state.body)) { this.props.action(this.state); this.setState({ body: "" }); e.target.innerHTML = ""; } } render() { return (