@primer/react
Version:
An implementation of GitHub's Primer Design System using React
19 lines • 812 B
TypeScript
/**
* SSR-safe hook for determining if the current platform is MacOS.
*
* Uses `useSyncExternalStore` to read the platform value:
*
* - On the **client**, `ssrUnsafeIsMacOS` reads `navigator.userAgent` and
* returns the real value immediately, with no extra render pass.
*
* - On the **server**, returns `false`. During hydration, if the snapshots
* differ, React handles the mismatch internally in a single synchronous
* pass, avoiding the layout shift that a deferred `useEffect` + `setState`
* would cause.
*
* Previous implementation used `useState` + `useEffect`, which caused an
* unconditional second render on every mount (even on the client where the
* initial value was already correct).
*/
export declare function useIsMacOS(): boolean;
//# sourceMappingURL=useIsMacOS.d.ts.map