Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save brennancheung/13708e3303eed09b912c4001bbe4025f to your computer and use it in GitHub Desktop.

Select an option

Save brennancheung/13708e3303eed09b912c4001bbe4025f to your computer and use it in GitHub Desktop.
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