I want to use Autocomplete
component for input tags. I\'m trying to get the tags and save them on a state so I can later save them on the database. I\'m using funct
I needed to hit my api on every input change to get my tags from backend!
Use Material-ui onInputChange if you want to get your suggested tags on every input change!
this.state = {
// labels are temp, will change every time on auto complete
labels: [],
// these are the ones which will be send with content
selectedTags: [],
}
}
//to get the value on every input change
onInputChange(event,value){
console.log(value)
//response from api
.then((res) => {
this.setState({
labels: res
})
})
}
//to select input tags
onSelectTag(e, value) {
this.setState({
selectedTags: value
})
}
option.title}
onChange={this.onSelectTag} // click on the show tags
onInputChange={this.onInputChange} //** on every input change hitting my api**
filterSelectedOptions
renderInput={(params) => (