August 2017
Beginner
374 pages
10h 41m
English
We start by creating a component that displays a user object (username and real name).
Create a src/components/User.jsx file, with the following contents:
import React from 'react'
const User = ({ username, realname }) =>
<span>@{username} ({realname})</span>
export default User
Because we are going to import components directly, we do not need to create a src/components/index.js file that re-exports all components. We are going to import components as follows:
import User from './components/User.jsx'
Read now
Unlock full access