Hey I am trying to change options of select input in form based on previous select input but somehow this select does not render...any idea? Might that be because it cannot be rendered immedeatly or do I have my syntax wrong. The options here (other than "Choose district") just dont get rendered
<Form.Select
style={{ border: error ? "2px solid red" : "" }}
onChange={handleFormData("district")}
>
{" "}
<option>Choose district</option>
{regions.map((region) => {
if (region.region === districts) {
console.log(districts);
region.districts.split(",").map((district) => {
return <option value={district}>{district}</option>;
});
console.log(region.districts.split(","));
}
})}
</Form.Select>
This is the array that gets printed in the last console log
[ "Benešov", " Beroun", " Kladno", " Kolín", " Kutná Hora", " Mělník", " Mladá Boleslav", " Nymburk", " Praha-východ", " Praha-západ", " Příbram a Rakovník" ]