August 2017
Beginner
374 pages
10h 41m
English
Let's recap the structure of a post so that we can think about how to display all the data from it:
{
user: 'dan',
title: 'Test Post',
text: 'hello world!',
category: 'test',
created: 1491828725892,
updated: 1491828725892
}
To display the user property, we are going to use a container component to replace the username with a user object so that we can directly pass it down to the User component. Displaying the title, text, and category properties should be straightforward. For the created and updated properties, we will create a Timestamp component that displays the date/time later.
Create a src/components/Post.jsx file with the following contents:
import React from 'react' import User from './User.jsx' import Timestamp from ...
Read now
Unlock full access