Add function to manage the notifications to react component #193
RuslanHryn
started this conversation in
General
Replies: 1 comment 2 replies
-
Hi Ruslan, I can see how this would be useful, but it would take some time to implement. Have you also tried our react-headless SDK? Is that something you could use to solve your needs? The useNotifications hook is reactive to store updates, so I'm thinking something in the line of: import { useNotifications } from '@magicbell/react-headless';
function Notifications() {
const store = useNotifications();
const notifications = store.notifications
.sort((a, b) => /* priority sorting */)
.filter(n => /* filter out some */)
);
return <YourInbox notifications={notifications} />
} Granted, though you can reuse some of our React components, you will need to recreate the UI. In the meanwhile, I'll give your request some thought on how & when we could implement it. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be nice to have a function that will be triggered when new notification/notifications arrive to change the order of notifications or filter out old notifications etc.
So the function should be invoked when new notifications are made, but before rendering notifications on UI
Input parameter is all received notifications and the function returns notifications that should be shown on UI
(notifications) => notifications
This function will allow adding some custom logic to pre-process notifications. For example, re-order the notification to implement priority of messages or filter out old notifications
Beta Was this translation helpful? Give feedback.
All reactions