Skip to content

Instantly share code, notes, and snippets.

@whtswrng
Created October 7, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whtswrng/9811338b037a314cd45c89211b504b76 to your computer and use it in GitHub Desktop.
Save whtswrng/9811338b037a314cd45c89211b504b76 to your computer and use it in GitHub Desktop.
class UserTable extends Component {
...
render() {
const user = {id: 1, name: 'Thomas', surname: 'Foobar', age: 33};
return (
<div>
...
<UserRow user={user}/>
...
</div>
);
}
...
}
class UserRow extends Component {
static propTypes = {
user: PropTypes.object.isRequired,
};
render() {
return (
<tr>
<td>Id: {this.props.user.id}</td>
<td>Name: {this.props.user.name}</td>
</tr>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment