isBrowser
A library that checks if the code is running in a browser.
Installation
npx shadcn@latest add @hooks/is-browserpnpm dlx shadcn@latest add @hooks/is-browseryarn dlx shadcn@latest add @hooks/is-browserbun x shadcn@latest add @hooks/is-browserCopy and paste the following code into your project.
/**
* A library that checks if the code is running in a browser.
*/
export const isBrowser = typeof window !== 'undefined'Last updated on