2022-03-17
1925
#firebase#react
Kapeel Kokane
31568
Mar 17, 2022 â‹… 6 min read

Push notifications with React and Firebase

Kapeel Kokane Coder by day, content creator by night, learner at heart!

Recent posts:

Solving The Node.js Console.Time Is Not A Function Error

Solving the Node.js console.time is not a function error

Explore the two variants of the `console.time is not a function` error, their possible causes, and how to debug.

Joseph Mawa
Nov 1, 2024 â‹… 6 min read
Why jQuery 4 Is A Good Reminder To Stop Using jQuery

Why jQuery 4 is a good reminder to stop using jQuery

jQuery 4 proves that jQuery’s time is over for web developers. Here are some ways to avoid jQuery and decrease your web bundle size.

Shalitha Suranga
Oct 31, 2024 â‹… 11 min read
How to Create a Multilevel Dropdown Menu in React

How to create a dropdown menu in React

See how to implement a single and multilevel dropdown menu in your React project to make your nav bars more dynamic and user-friendly.

Ibadehin Mojeed
Oct 30, 2024 â‹… 12 min read
Purple background with different connections between icons for an article about building Node.js modules with Rust and NAPI-RS.

Building Node.js modules in Rust with NAPI-RS

NAPI-RS is a great module-building tool for image resizing, cryptography, and more. Learn how to use it with Rust and Node.js.

Rahul Padalkar
Oct 30, 2024 â‹… 7 min read
View all posts

13 Replies to "Push notifications with React and Firebase"

  1. Hey, thanks for this guide.

    On Windows and Android this works as expected, however, on Safari (iOS) this just gives a white / blank screen.

    Obviously, Safari does not support Web push notifications but is there a way to exclude Messaging initialization if it’s not supported? As currently I suppose this is the root cause.

    What would be the required code adjustments to do this, can you suggest anything?

    Thanks,
    John

  2. hey,thanks for this code
    windows browser its working but mac-book chrome browser not receiving notification?

  3. Maybe its just me, but i tried duplicating this project on codesandbox enabling notifications for the site but I keep getting this Firebase Messaging Notification permission was not granted.

  4. Hi,

    Thanks for the article. How about registering the firebase service worker? Can’t find in the code the place where we register the “firebase-messaging-sw.js” by calling navigator.serviceWorker.register(‘/firebase-messaging-sw.js’)

  5. “Cannot read properties of undefined (reading ‘getProvider’)” got this error while implementing in app.js

  6. Hey! While I was adding the getToken function in firebase.js and importing firebase.js in app.js using the import statement: `import { getToken } form firebase.js`

    I got an error stating:- Identifier ‘getToken’ has already been declared. (23:13)

    Can you please help me out.
    Thanks

      1. The solution is just to change the name of the function to “fetchToken” (You can see this as well, if you open the github repo)
        If you just reference it as this, it will work

  7. What if i want to hide firebaseconfig because it can be easily accessible by anyone who will visit the application and can use the firebase config keys.

Leave a Reply