one-hook
Size
0.13 kb
View source

useIsHydrated

Once `true`, no hydration error can occur.

Prevent hydration mismatches by conditionally rendering content that depends on browser APIs.

Installation

npm install @1hook/use-is-hydrated

Usage

import {  } from '@1hook/use-is-hydrated'

Check if the component is hydrated:

function () {
  const  = ()

  if (!) return null

  return <>{.()}</>
}

On this page