Listing 4-17: Using props in a class component

import {Component} from 'react';
class BasicFigureProps extends Component {
render() {
return(
<figure>
<img style={{width:"150px"}} src={this.props.filename} alt={this.props.caption} />
<figcaption>{this.props.caption}</figcaption>
</figure>
);
}
}
export default BasicFigureProps;
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.