12 lines
350 B
TypeScript
12 lines
350 B
TypeScript
import React, { type PropsWithChildren, useEffect } from "react";
|
|
|
|
export default function Root({ children }: PropsWithChildren) {
|
|
useEffect(() => {
|
|
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
|
void navigator.serviceWorker.register("/workshop-sw.js", { scope: "/" });
|
|
}
|
|
}, []);
|
|
|
|
return children;
|
|
}
|