Quiz Question 1 of 6
In the piece of code below will the new student be added before or after the existing students in prevStudents
.
const Students = () => {
const [students, setStudents] = useState([
//array of student objects
]);
setStudents(prevStudents => [
{
// new student object
},
...prevStudents
]);
return (...)
}
Choose the correct answer below: