Created
October 7, 2018 16:58
-
-
Save whtswrng/d232c314fa42f0b1f1bbb07a5464e0cc to your computer and use it in GitHub Desktop.
This file contains 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
class UserTable extends Component { | |
... | |
render() { | |
const user = {id: 1, name: 'Thomas', surname: 'Foobar', age: 33}; | |
return ( | |
<div> | |
... | |
<UserRow id={user.id} name={user.name}/> | |
... | |
</div> | |
); | |
} | |
... | |
} | |
class UserRow extends Component { | |
static propTypes = { | |
id: PropTypes.number.isRequired, | |
name: PropTypes.string.isRequired, | |
}; | |
render() { | |
return ( | |
<tr> | |
<td>Id: {this.props.id}</td> | |
<td>Name: {this.props.name}</td> | |
</tr> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment