I am trying to build an app, which has a feature of selecting several users. I have created a useState:
const [selectedStudents, setSelectedStudents] = useState<number[]>([]);
I have moved the setSeletedStudents function to other component using props and try to modify it like this:
props.selectStudent((prev) => [
...prev, ...props.student.id,
]);
I have tried creating a function in original component an passing it to that component, also tried using the actual SelectedStudents instead of prev The error I get:
Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator