Hide action buttons after click
Is there a way to hide the action buttons below a notification after one of them is clicked? For example, when making a request, I want to hide the buttons after the receiver of the notification clicks "Accept" to accept it. Here's the related code so far:
I tried using
useNotifications
to update the status of the notification to see if that'd do it, but the hook returns null
for some reason, even though I've set fetchNotifications
to true
.
Thanks in advance!6 Replies
I hope that this section might help you:
https://docs.novu.co/notification-center/client/react/get-started#onactionclick
Thanks Emil
@ninadk
let us know if it is not working for you
Thank you for your response! I added the code as suggested to mark the action as done after a click, but it still seemed to only remove the buttons when I marked the notifications as read. I opted to mark the notification as read programmatically after the action button is clicked, and bumped into this error:
No QueryClient set, use QueryClientProvider to set one
. After wrapping the application with QueryClientProvider
it doesn't seem to go away. Any ideas?
@ninadk
Apologies for inconvenience
We need to update the docs with latest code example
correct sample code is this
thank you, that worked! I also removed QueryClientProvider altogether, afterwords, it seems it's not necessary anymore.
Thanks for the update. I just updated this in docs. It will be live in few days