The following code
const [selectedIndex, setSelectedIndex] = useState<number | null>(null);
const handleClick = (event: React.MouseEvent<HTMLElement>, index: number, row: NestedItem) => {
setAnchorEl(event.currentTarget);
setSelectedIndex(index)
};
Problem is from above code was when i set the value of setSelectedIndex(index) as index value as 0 then if print the value selectedRow it is printing value as null but it suppose to be print value as 0 only but not null ? how to achieve that if set value as 0 then it should consider 0 only ,when i tried set values manually as 1 and 0 then it able to print when i gave value as 1 but when gave value as 0 it printing value as null ? Therefore problem here is when we set value as 0 it should be consider 0 only but not null? how to achieve that?