I have a function as following:
changeLocale = (e) => {
console.log(e.target.value)
this.setState({
localIndex: e.target.value
});
console.log('localIndex', this.state.localIndex)
this.setValue({id:"locale_id", value:this.props.metadata["latest"].locales[this.state.localIndex].id, error:null})
}
console.log(e.target.value) prints 0, however second print statement prints null. Why my state is not set for localIndex? What am I doing wrong?