function formatDate(date) {
return date.toLocaleDateString();
}
function Comment(props) {
return (
{props.author.name}
{props.text}
{formatDate(props.date)}
);
}
const comment = {
date: new Date(),
text: 'I hope you enjoy learning React!',
author: {
name: 'Hello Kitty',
avatarUrl: 'https://placekitten.com/g/64/64',
},
};
ReactDOM.render(
,
document.getElementById('root')
);