const onCheckedValue = (notification, event) => {
console.log('notification', notification);
console.log('event', event);
};
// I want to pass the event and another parameter to the above function how can I achieve that?
<Checkbox
checked={notification.is_selected}
onChange={onCheckedValue(notification,event)}
value={notification}
/>
>Solution :
The easiest way would be to use an anonymous function:
<Checkbox onChange={(event)=>onCheckedValue(notification, event)} />
Your version doesn’t work because you call the function onCheckedValue during render, which means that the you’re setting the return value of oncheckedValue to the prop onChange instead of the function itself.