Skip to content

Instantly share code, notes, and snippets.

@suzdalnitski
Last active November 13, 2018 00:56
Show Gist options
  • Save suzdalnitski/e936f5d857166192e1fba832ba4202d0 to your computer and use it in GitHub Desktop.
Save suzdalnitski/e936f5d857166192e1fba832ba4202d0 to your computer and use it in GitHub Desktop.
const User = ({ name, friends }) => (
<div>
Name: {name}
{friends && friends.map(friend => <User key={friend.name} {...friend} />)}
</div>
);
User.propTypes = {
name: PropTypes.string.isRequired,
friends: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired
})
)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment