I was looking through some code while using the npm package React-Select
Interestingly enough i saw setState being used as such:
handleSelectChange (value) {
console.log('You\'ve selected:', value);
this.setState({ value });
},
How does setState work like this? It only provides one value? I am asking because I would like to perhaps capture one thing from my input and then change it. But that doesn't work as intended.
handleSelectChange (value) {
console.log('You\'ve selected:', value);
this.setState({ value.name });
},
The full code is here, its fairly short: https://github.com/JedWatson/react-select/blob/master/examples/src/components/Multiselect.js