I was using Ant Design Checkbox
earlier to check and publish the comments and it was working fine with no errors.
<Checkbox
key={record.id}
checked={Publish[record?.id]?.["ispublish"] == 'true' ? true : false}
onChange={(e) => Update(e.target.checked, record)}
/>
I want to use Switch
instead.
<Switch
key={record.id}
checked={Publish[record?.id]?.["ispublish"] == 'true' ? true : false}
onChange={(e) => Update(e.target.checked, record)}
/>
I am getting error:
cannot read properties of undefined (reading ‘checked)
I want Switch
to work.