<select className="form-select" onChange={(e)=>changeCountry(e)}>
<option selected>Country</option>
{Country.getAllCountries().map((item,index)=>(
<option value={item.name.toUpperCase()} code={item.isoCode} key={index}>{item.name}</option>
))}
</select>
In this select input code i want to save the countries in normal words but i still need the isoCode because i need to fetch the states of that country
so when i am doing this by changeCountry function
const changeCountry = (e)=>{
setCountry(e.target.value)
console.log(e.target.code)
console.log("The state of the country",State.getStatesOfCountry(e.target.code))
setAllStateType(State.getStatesOfCountry(e.target.code))
}
Here why i am getting the code is undefined if i am getting it how can i pass the iso code to get the states of that country
how i solve this question by passing all the element in the value by Adding + ve sign and then split back