Skip to content

Search Bar

brandonk1234 edited this page Dec 5, 2016 · 2 revisions

SearchBar

The search bar component allows the user to query results by typing inside the input field. The component consists of one secondary button and a input element.

Props

The props needed for this component are listed and explained below:

  • onClick - This prop must be a function

  • onChange - This prop must be a function. Remember that the onChange always passes up the event.target.value.

Example

<SearchBar 
    onClick={this.onClick} 
    onChange={this.onChange} 
/>

// ...React Component
onClick: function() {
    console.log('this search button has been clicked');
},

onChange: function(value) {
    this.setState({
        searchText: value
    })
},

Related