Package Exports
- @avent-ui/use-render-env
- @avent-ui/use-render-env/dist/index.esm.js
- @avent-ui/use-render-env/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@avent-ui/use-render-env) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AventUI - useRenderEnv
The useRenderEnv hook determines whether the component is being rendered on the server (SSR) or the client (CSR) and provides the current state, including a loading indicator. It uses useEffect to update the state once the component is hydrated on the client, ensuring the correct environment is reflected.
Installation
1. Install the Component via npm:
npm install @avent-ui/useRenderEnv3. Import the hook
import useRenderEnv from '@avent-ui/useRenderEnv';
4. Use it to find your Rendering Environment
// return boolean values
const { isLoading, isClient, isServer } = useRenderEnv();
Properties
| Prop | Type | Description |
|---|---|---|
isClient |
boolean |
Indicates whether the component is being rendered on the client side |
isServer |
boolean |
Indicates whether the component is being rendered on the server side |
isLoading |
boolean |
Represents the loading state of the component, while data is fetched or app is hydrated |