Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- export default class Comment extends React.Component {
- formatDate(rawDate) {
- date.toLocaleDateString()
- }
- render() {
- return (
- <div className='comment'>
- <div className='user-info'>
- <img className='avatar'
- src={props.author.avatarUrl}
- alt={props.author.name}
- />
- <div className='name'>{props.author.name}</div>
- </div>
- <div className='text'>
- {props.text}
- </div>
- <div className="date">
- {formatDate(props.date)}
- </div>
- </div>
- )
- }
- }
- //How to specify the author here?
- <Comment author={avatarUrl='localhost/avatar12203.png' name='Nuff'} text='This is a test comment' date={new Date()}></Comment>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement