Skip to content

Instantly share code, notes, and snippets.

@jsmney
Last active April 20, 2020 17:00
Show Gist options
  • Select an option

  • Save jsmney/a82d6220411c36da8c6594d350edcd93 to your computer and use it in GitHub Desktop.

Select an option

Save jsmney/a82d6220411c36da8c6594d350edcd93 to your computer and use it in GitHub Desktop.
import React from 'react'
const SingleBird = props => {
return (
<div className="singleBird">
<h3>{props.bird.name}</h3>
<p>{props.bird.fed ? 'I have been fed!' : 'I need some food'}</p>
<button onClick={() => props.feedBird(props.bird.id)}>Feed</button>
</div>
)
}
SingleBird.propTypes = {
feedBird: PropTypes.func.isRequired,
bird: PropTypes.shape({
id: PropTypes.number,
name: PropTypes.string,
fed: PropTypes.bool
}).isRequired
}
export default SingleBird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment