Hey Danielly, Thank you for this informative article. I have been following this article to convert my React app to PWA but when I am clicking on the refresh button I am getting an error.
Uncaught TypeError: e.postMessage is not a function.
Could you please help me with this?
I'm so sorry not seeing your comment before... I think that maybe the setState function is not updating the state before calling the post message function ( reactjs.org/docs/state-and-lifecyc...).
Or if it's an old version, maybe the create-react-app doesn't create the service-worker file with postMessage function and you must configure the webpack configuration manually
Check the state object that you save. If you are just saving "registration" object it will give you this error you should save "registration.waiting".
(That was my case, same error)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Danielly, Thank you for this informative article. I have been following this article to convert my React app to PWA but when I am clicking on the refresh button I am getting an error.
Uncaught TypeError: e.postMessage is not a function.
Could you please help me with this?
I'm so sorry not seeing your comment before... I think that maybe the setState function is not updating the state before calling the post message function ( reactjs.org/docs/state-and-lifecyc...).
Or if it's an old version, maybe the create-react-app doesn't create the service-worker file with postMessage function and you must configure the webpack configuration manually
Check the state object that you save. If you are just saving "registration" object it will give you this error you should save "registration.waiting".
(That was my case, same error)