
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@sws2apps/react-sw-helper
Advanced tools
A pure react component for managing service worker life cycle. This project is inspired by the project @medipass/react-service-worker published by @medipass (it is currently inactive for 4 years now). Tailored to our needs, and hopefully for you too, here are the differences from the original one:
npm i @sws2apps/react-sw-helper
Import the <ServiceWorkerWrapper> component and wrap it around your application.
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import ServiceWorkerWrapper from '@sws2apps/react-sw-helper';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<ServiceWorkerWrapper publicServiceWorkerDest='/service-worker.js'>
<App />
</ServiceWorkerWrapper>
</React.StrictMode>
);
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import ServiceWorkerWrapper from '@sws2apps/react-sw-helper';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<ServiceWorkerWrapper
onError={(err) => console.log(`An error occured: ${err}`)}
onInstalled={() => console.log('Service worker installed')}
onUpdated={() => console.log('Service worker updated')}
onWaiting={() => console.log('Service worker waiting')}
publicServiceWorkerDest='/service-worker.js'
>
{({ update }) => <App updatePwa={update} />}
</ServiceWorkerWrapper>
</React.StrictMode>
);
<ServiceWorkerWrapper> props
string
The destination of where your service worker is located.
Example usage:
<ServiceWorkerWrapper publicServiceWorkerDest="/service-worker.js" />
string| Optional
The public URL of your application. Defaults to the root origin.
Example usage:
<ServiceWorkerWrapper publicUrl="https://example.com/app" />
function(error: Error)| Optional
Invoked when an error occurs during service worker registration.
Example usage:
<ServiceWorkerWrapper onError={err => console.log(`An error occured! Error: ${err}`)} />
function()| Optional
Invoked when the service worker is installed.
Example usage:
<ServiceWorkerWrapper onInstalled={() => console.log('Service worker successfully installed.')} />
function()| Optional
Invoked when the service worker is updated.
Example usage:
<ServiceWorkerWrapper onUpdated={() => console.log('Service worker successfully updated.')} />
function()| Optional
Invoked when the service worker is already installed but waiting to be activated.
Example usage:
<ServiceWorkerWrapper onWaiting={() => console.log('Service worker already installed but waiting to be activated.')} />
children Render Props
function()
When invoked, update will update the service worker. Please note that this function does not reload the page.
FAQs
A pure react component library to handle service worker
The npm package @sws2apps/react-sw-helper receives a total of 63 weekly downloads. As such, @sws2apps/react-sw-helper popularity was classified as not popular.
We found that @sws2apps/react-sw-helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.