I have a list of option
, I'm getting from the API. I'm using .map()
and When I change the option I want the specific option object so I can store that inside of redux store.
<select
onChange={() => handleChange()}
className="pl-2 bg-white font-medium border-none"
>
{outlets.map((outletItem) => (
<option key={outletItem.outlet_id} value={outletItem.outlet_id}>
{outletItem.name}
</option>
))}
</select>
Here, outlets
is an array from the API. I want the specific value of the array when I make a change.
handleChange()
const handleChange = () => {
dispatch(addSelectedOutlet(outlets));
};