Created
April 28, 2018 04:07
-
-
Save Didericis/ff003c7949693f1ff2b92f36d6d6e721 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 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