This might be pretty basic but i am not able to find out what is wrong here. I have a react form in which i am using a custom select box to list the students. I want to clear the selection when isChecked is set to false.
let studentId = watch("std.id"); // is of type number
<Select
name="std.id"
placeholder="Select Students"
registerResult={register("std.id")}
list={studentList}
disabled={!isChecked}
/>
I tried emptying with "" the value also tried assigning it to null like below, but didnt work. can anyone tell me why is it not resetting?
if(!isChecked){
studentId = null; //Select box still shows the selected value even after this
}