Show data fetched from server and post it back to server from the input box
I am making a component which will have a react-tagsinput input box. the input will fetch data from the server and if there is data it will show the data as tags in the input just like the example shown in: https://olahol.github.io/react-tagsinput/ and also there will be options for user to give new input as tags, at last the data from the input will be posted to the server along with the data fetched and new data given as tags. is there props to work in this way? what are the props should I use and how? a full working example code would be very helpful. Right now my code looks like this: `constructor(props){ super(props); this.handleChange = this.handleChange.bind(this); this.handleChangeInput = this.handleChangeInput.bind(this); this.state = { tags: [], tag: '' }; } handleChange(tags){ if (tags.length > this.state.tags.length){ this.onTagAdd(tags[tags.length - 1]); }
this.setState({ tags });
}
handleChangeInput(tag){
this.setState({tag})
}
clearInput(){
this.setState({tags: []});
}
onTagAdd(tag){
console.log(tag);
}
<TagsInput value={this.state.tags} onChange={this.handleChange} inputValue={this.state.tag} onChangeInput={this.handleChangeInput} inputProps={ {placeholder: 'Write a synonym and hit enter'} } /> ` @olahol please help me out.
same issue.