@suspensive/react
Version:
Suspensive interfaces for react
9 lines (7 loc) • 300 B
text/typescript
'use client'
import { useSyncExternalStore } from 'react'
import { noop } from './utils/noop'
const emptySubscribe = () => noop
const getSnapshot = () => true
const getServerSnapshot = () => false
export const useIsClient = () => useSyncExternalStore(emptySubscribe, getSnapshot, getServerSnapshot)