# @charlietango/use-client-hydrated

> Check if the client has been hydrated

Latest version **1.10.0** (published 2022-04-14) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @charlietango/use-client-hydrated
pnpm add @charlietango/use-client-hydrated
yarn add @charlietango/use-client-hydrated
bun add @charlietango/use-client-hydrated
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.10.0 |
| Published | 2022-04-14 |
| First published | 2020-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | thebuilder, frederik_bosch |
| Keywords | react, hooks |

## Links

- npm: https://www.npmjs.com/package/@charlietango/use-client-hydrated
- Repository: https://github.com/charlie-tango/hooks
- Homepage: https://github.com/charlie-tango/hooks#readme
- Issues: https://github.com/charlie-tango/hooks/issues
- npm.io page: https://npm.io/package/@charlietango/use-client-hydrated

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.10.0 (latest) — 2022-04-14
- 1.9.0 — 2020-10-19
- 1.8.2 — 2020-06-09
- 1.8.1 — 2020-01-14
- 1.8.0 — 2020-01-14

## README

# useClientHydrated

Check if the client has been hydrated. This hook only informs you of the current hydration state, and
doesn't trigger a new render once the client becomes hydrated. To check that, you'd combine it with
a `useEffect` to trigger a new render.

> Checkout the [Storybook](https://ct-hooks.now.sh/?path=/story/useclienthydrated--readme) demo.

## Installation

```sh
yarn add @charlietango/use-client-hydrated
```

## API

```js
const output = useClientHydrated()
```

## Example

```jsx
import React, { useEffect, useState } from 'react'
import useClientHydrated from '@charlietango/use-client-hydrated'

const Component = () => {
  const hydrated = useClientHydrated()

  // Set the initial ready state based on hydrated. Will be `false` first time the component is rendered, but true after hydration.
  const [ready, setReady] = useState(hydrated)

  useEffect(() => {
    // We have been hydrated correctly now
    setReady(true)
  }, [])

  return <div>{ready ? 'Hydrated' : 'Hydrating'}</div>
}

export default Component
```

---
_Source: https://npm.io/package/@charlietango/use-client-hydrated · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
