Skip to content

Instantly share code, notes, and snippets.

@doug2k1
Last active September 28, 2016 04:00
Show Gist options
  • Save doug2k1/9a7e260c96ffcb2777a85b4bbfc1d057 to your computer and use it in GitHub Desktop.
Save doug2k1/9a7e260c96ffcb2777a85b4bbfc1d057 to your computer and use it in GitHub Desktop.
class UserListContainer extends React.Component {
...
toggleActive (event) {
// event logic
}
render () {
return (
<UserList users={this.state.users} toggleActive={this.toggleActive} />
);
}
}
const UserList = (props) => {
return (
<ul>
{props.users.map(user => {
return (
<li key={user.id}>
<input type="checkbox" onChange={props.toggleActive} />
{user.name}
</li>
);
})}
</ul>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment