Last active
August 11, 2018 07:35
-
-
Save emmabostian/c8dbf6e17683e0bbcd12c03348ddab1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class Recipe extends Component { | |
render() { | |
const ingredients = this.props.ingredients.map((ingredient, i) => <li key={i}>{ingredient}</li>); | |
const steps = this.props.steps.map((step, i) => <li key={i}>{step}</li>); | |
return ( | |
<div className="Recipe"> | |
<h2>{this.props.title}</h2> | |
<h3>Ingredients</h3> | |
<ul> | |
{ingredients} | |
</ul> | |
<h3>Steps</h3> | |
<ul> | |
{steps} | |
</ul> | |
</div> | |
); | |
} | |
} | |
Recipe.propTypes = { | |
ingredients: PropTypes.array.isRequired, | |
steps: PropTypes.array.isRequired, | |
title: PropTypes.string.isRequired | |
}; | |
export default Recipe; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment