--- order: 0 title: zh-CN: 基本评论 en-US: Basic comment --- ## zh-CN 一个基本的评论组件,带有作者、头像、时间和操作。 ## en-US A basic comment with author, avatar, time and actions. ```jsx import { Comment, Tooltip, Avatar } from 'antd'; import moment from 'moment'; import { Dislike, Like, DislikeFilled, LikeFilled } from '@ant-design/icons'; class App extends React.Component { state = { likes: 0, dislikes: 0, action: null, }; like = () => { this.setState({ likes: 1, dislikes: 0, action: 'liked', }); }; dislike = () => { this.setState({ likes: 0, dislikes: 1, action: 'disliked', }); }; render() { const { likes, dislikes, action } = this.state; const actions = [ {React.createElement(action === 'liked' ? LikeFilled : Like, { onClick: this.like, })} {likes} , {React.createElement(action === 'liked' ? DislikeFilled : Dislike, { onClick: this.dislike, })} {dislikes} , Reply to, ]; return ( Han Solo} avatar={ } content={ We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently. } datetime={ {moment().fromNow()} } /> ); } } ReactDOM.render(, mountNode); ```
We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.