serviceWorker vs reportWebVitals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

serviceWorker vs reportWebVitals

I've started to build a react app using create-react-app (https://create-react-app.dev/docs/getting-started/) and the tutorial I'm following has serviceWorker but the build setup I've downloaded doesn't have serviceWorker and instead has reportWebVitals. Do these two work the same? is serviceWorker not supported anymore? And if I use reportWebVitals, will it affect the working of other files (syntax/logic) ?

24th Oct 2022, 9:04 AM
Asha
Asha - avatar
1 Answer
+ 5
In older versions of create-react-app serviceworker was bundled; but newer versions dont have them and have webvitals. You can still use service workers if you want. https://create-react-app.dev/docs/making-a-progressive-web-app https://create-react-app.dev/docs/measuring-performance/#web-vitals
11th Nov 2022, 9:44 AM
Malai Raja D
Malai Raja D - avatar