text: import React, { Component } from "react";
  import PropTypes from "prop-types";
  import CommentBox from "./presenter";
  
  class Container extends Component {
    state = {
      comment: ""
    };
  
    static propTypes = {
      photoId: PropTypes.number.isRequired,
      submitComment: PropTypes.func.isRequired
    };
  
    render() {
      return (
        <CommentBox
          {...this.state}
          {...this.props}
          handleKeyPress={this._handleKeyPress}
          handleInputChange={this._handleInputChange}
        />
      );
    }
  
    _handleInputChange = event => {
      const { target: { value } } = event;
      this.setState({
        comment: value
      });
    };
  
    _handleKeyPress = event => {
      const { submitComment } = this.props;
      const { comment } = this.state;
      const { key } = event;
      if (key === "Enter") {
        event.preventDefault();
        submitComment(comment);
  
        this.setState({
          comment: ""
        });
      }
    };
  }
  
  export default Container;
  