Listing 4-16: Using props to pass data to a child component



import {Component} from 'react';
import BasicFigureProps from './BasicFigureProps';
class FigureList extends Component {
render() {
return (
<div style={{display:"flex"}}>
<BasicFigureProps filename="dog.jpg" caption="Chauncey" />
<BasicFigureProps filename="cat.jpg" caption="Murray" />
<BasicFigureProps filename="chickens.jpg" caption="Lefty and Ginger" />
</div>
)
}
}
export default FigureList;
Download the examples, report issues, and ask/answer questions in the discussion area by visiting the book's github page. All of the code for the book is also available on codesandbox.io for you to play around with.
ReactJS Foundations is published by John Wiley and Sons, Inc and is available in paperback and eBook.