Incorporating two headings, "Unread" and "Read", into the notification system is my goal. When opened, the Unread Notifications should be displayed beneath the Read notifications. This data is being retrieved from an API.
Each notification contains a key called 'isRead' with a default value of false. I attempted to achieve this using the following code:
const { mutate: markRead } = useMutation(markNotificationRead, {
onSuccess: () => {},
onError: () => {},
});
const handleDropDownToggle = () =>
setIsDropDownOpen(!isDropDownOpen);
toggleDropdown(item._id);
!isDropDownOpen ? markRead(item?._id) : false
};