-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi
I was wondering if you could provide with some example code about how to store all the notifications received from FCM in a useState (array). All the examples I see on github or Google handle notifications in one main useEffect, which is executed once only
useEffect(() => {
// req user permission
// get token
// block of code that is executed each time notif. arrives
const unsubscribe = messaging().onMessage(async remoteMessage => {
// save notification
});
return () => unsubscribe();
}, []);
Therefore I cannot store the notifications somewhere, for example
const [notifications, setNotifications] = useState<NotificationType[]>([]);
Thanks
Metadata
Metadata
Assignees
Labels
No labels