()
| 207 | * until after hydration. |
| 208 | */ |
| 209 | export function useIsSSR(): boolean { |
| 210 | // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating. |
| 211 | // oxlint-disable-next-line react/react-compiler |
| 212 | if (typeof React['useSyncExternalStore'] === 'function') { |
| 213 | // oxlint-disable-next-line react/react-compiler |
| 214 | return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot); |
| 215 | } |
| 216 | |
| 217 | // oxlint-disable-next-line react/react-compiler, react-hooks/rules-of-hooks |
| 218 | return useContext(IsSSRContext); |
| 219 | } |
no outgoing calls
no test coverage detected