const initialProgram = {
id: 0,
studentId : 0,
targets : []
}
const [program, setProgram] = useState(initialProgram);
In one of my functions I am updating the program as follows: setProgram({...program,studentId= selectedStudent?.id})
The type definition for selected Student is: selectedStudent: Student | undefined;
I need to make sure that selectedStudent remains unchanged.
How can I modify initialState to fix this error?