I have the following code but when i change the value from drop-down the drop-down sticks to Select the status Rather changing it to the selected value i.e
const [formData, setFormData] = useState({
title: "",
status: "",
priority: "",
start_date: new Date(),
due_date: new Date(),
progress: 0,
user_id: null,
});
const task_statuses = ["active", "pending", "inactive", "completed"];
const setData = (e) => {
setFormData({ ...formData, [e.target.name]: e.target.value });
};
<select onChange={setData} name="status">
<option value=""> Select Task Status </option>
{task_statuses.map((status) => {
return (
<option key={shortid.generate()} value={status}>
{capitalizeFirstLetter(status)}
</option>
);
})}
</select>
I would like it to change it to selected option, can't do it please help
Please Help