I am sorry if my question is silly, I am fairly new to Reactjs,
Please do not tell me to useHooks as I can't use it in my current project.
I am working on a form and on it's validations.
my relevant code:
//part of my state
this.state = {
form: {
country: null,
zipCode: "",
},
formErrors: {
country: null,
},
countryList: Array<string>(),
};
}
<Select name="country" defaultValue={countryOptions[1]} options={countryOptions} value={form.country} onChange={(e) => {
this.handleCountryChange({value : e.value, label: e.value })
}}
/>
{this.state.formErrors.country && (
<span className="err">{this.state.formErrors.country}</span>
)}
handleCountryChange(e : countrySelection){
const selectedCountry = e.value;
console.log(selectedCountry);
var formAux = { ...this.state };
formAux.form.country = selectedCountry;
}
but sadly my select keeps looking like this:
Even after I pick a country and I can see it with the console log above. What is missing here in order for the select to pick up the value?