{"library":"use-ssr","type":"library","category":null,"description":"The `use-ssr` package provides a lightweight React hook designed to detect the execution environment (server-side, browser, or React Native) within React components and hooks. Currently at version 1.0.25, this library offers a stable API for conditionally rendering or executing logic based on where the React application is running. It differentiates itself with zero runtime dependencies beyond React itself, comprehensive TypeScript support, and specific flags for React Native. The hook returns boolean flags (`isBrowser`, `isServer`, `isNative`) and an enum `device` string, along with capabilities like `canUseWorkers`, `canUseEventListeners`, and `canUseViewport`, making it versatile for isomorphic React applications. Its primary use case is in Universal or Server-Side Rendered (SSR) applications, such as those built with Next.js, where conditional logic based on the environment is critical for optimal performance and correct behavior.","language":"javascript","status":"active","version":"1.0.25","tags":["javascript","ssr","nextjs","server","server side rendering","server side","client","browser","isomorphic"],"last_verified":"Wed May 27","install":[{"cmd":"npm install use-ssr","imports":["import useSSR from 'use-ssr'"]},{"cmd":"yarn add use-ssr","imports":[]},{"cmd":"pnpm add use-ssr","imports":[]}],"homepage":null,"github":"https://github.com/alex-cory/use-ssr","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/use-ssr","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/use-ssr/compatibility"}}