Skip to content

Instantly share code, notes, and snippets.

@Didericis
Created April 28, 2018 04:07
Show Gist options
  • Save Didericis/ff003c7949693f1ff2b92f36d6d6e721 to your computer and use it in GitHub Desktop.
Save Didericis/ff003c7949693f1ff2b92f36d6d6e721 to your computer and use it in GitHub Desktop.
class ListComponent extends Component {
// need to make sure to define instance method (not prototype) if you need to access state
sort = () => {
console.log('Sort');
}
render() {
return (
<ListComponentHeader sort={this.sort} />
);
}
}
class ListComponentHeader extends Component {
render() {
return (
<ListComponentHeaderSortButton onClick={this.props.sort} />
);
}
}
class ListComponentHeaderSortButton extends Component {
render() {
return (
<button onClick={this.props.onClick} />
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment