I'm trying to create a list of select with one option but when changing any one they all changed, i want to handle them one by one. Im using map in order to get the data and display it using useState.
Here is the code below :
const positions = patients.data.map((element) => {
return element.first_name + " " + element.last_name;
});
const [Position, setPosition] = useState(positions[0]);
const [serviceList, setServiceList] = useState([{service:""}]);
const handleServiceAdd = () =>{
setServiceList([...serviceList,{service:""}])
}
const handleServiceRemove = (index) => {
const list = [...serviceList];
list.splice(index,1);
setServiceList(list);
}
