Created
August 1, 2018 22:21
-
-
Save brennancheung/13708e3303eed09b912c4001bbe4025f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 SearchBar extends React.Component { | |
| state = { | |
| searchTerm | |
| } | |
| onSearchTermChange = (data) => this.setState(...) | |
| handleSearch = () => ... | |
| handleClear = () => ... | |
| SearchField = () => <TextField onChange={this.onSearchTermChange} ></TextField> | |
| render () { | |
| return ( | |
| {this.props.children({ searchTerm: this.state.searchTerm, SearchField })} | |
| ) | |
| } | |
| } | |
| <SearchBar> | |
| {({ searchTerm, SearchField }) => ( | |
| <Selector searchTerm={searchTerm} /> | |
| <SearchField /> | |
| )} | |
| </SearchBar> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment