react-outline
Goal
We are going to make a Robodex
![Robodex Screenshot]()
Creating a Card
Delete
HelloComponentand start building the app with aCardcomponentStart by creating
Cardas a stateless component inCard.jswith hardcoded mock data
<div>
<img alt="photo" src="https://robohash.org/test?size=200x200"/>
<div>
<h2>Jane Doe</h2>
<p>jane.doe@gmail.com</p>
</div>
</div>Convert the hard-coded values into
id,name, andemailprops
Customizing the Cards
Then add JSON data to make each card different
robots.jsis available from the lesson 3 folder in the repo
Use destructuring to get values out of props
Static Checking with PropTypes
Install
prop-typespackage and implement this:
Checks the properties being passed into components
Styling
Add classes to the
Cardcomponent
Note use of back-quoted string as
srcattribute ofimgJavaScript string interpolation
But no quotes around the overall expression
JSX does that for us
Side note: the
srcURL doesn't have a protocolIt will use HTTP or HTTPS depending on what the page used
Last updated
Was this helpful?