import React, { PropTypes } from 'react'; import PureRenderMixin from 'react-addons-pure-render-mixin'; import CommentForm from './CommentForm/CommentForm'; import CommentList from './CommentList/CommentList'; import css from './CommentBox.scss'; export default class CommentBox extends React.Component { static propTypes = { pollInterval: PropTypes.number.isRequired, actions: PropTypes.object.isRequired, data: PropTypes.object.isRequired, }; shouldComponentUpdate() { return PureRenderMixin.shouldComponentUpdate.apply(this, arguments); } componentDidMount() { const { fetchComments } = this.props.actions; fetchComments(); this.intervalId = setInterval(fetchComments, this.props.pollInterval); } componentWillUnmount() { clearInterval(this.intervalId); } render() { const { actions, data } = this.props; const cssTransitionGroupClassNames = { enter: css.elementEnter, enterActive: css.elementEnterActive, leave: css.elementLeave, leaveActive: css.elementLeaveActive, }; return (
Text supports Github Flavored Markdown. Comments older than 24 hours are deleted.
Name is preserved. Text is reset, between submits.