SHARE
TWEET

Untitled

a guest Aug 19th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2.  
  3. export default class Comment extends React.Component {
  4.     formatDate(rawDate) {
  5.         date.toLocaleDateString()
  6.     }
  7.  
  8.     render() {
  9.         return (
  10.             <div className='comment'>
  11.                 <div className='user-info'>
  12.                     <img className='avatar'
  13.                         src={props.author.avatarUrl}
  14.                         alt={props.author.name}
  15.                     />
  16.                 <div className='name'>{props.author.name}</div>
  17.                 </div>
  18.                 <div className='text'>
  19.                     {props.text}
  20.                 </div>
  21.                 <div className="date">
  22.                     {formatDate(props.date)}
  23.                 </div>
  24.             </div>
  25.         )
  26.     }
  27. }
  28.  
  29. //How to specify the author here?
  30. <Comment author={avatarUrl='localhost/avatar12203.png' name='Nuff'} text='This is a test comment' date={new Date()}></Comment>
RAW Paste Data
Top