1.0.2 • Published 1 year ago

@avent-ui/use-render-env v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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/useRenderEnv

3. 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

PropTypeDescription
isClientbooleanIndicates whether the component is being rendered on the client side
isServerbooleanIndicates whether the component is being rendered on the server side
isLoadingbooleanRepresents the loading state of the component, while data is fetched or app is hydrated
1.0.2

1 year ago

1.0.1

1 year ago

1.0.5

1 year ago