Docs
useMounted

Determine if a component is mounted with the useMounted hook.

Installation

pnpm dlx shadcn@latest add https://usekit.kiron.dev/k/use-mounted

Usage

"use client"
 
import { useMounted } from "@/hooks/use-mounted"
 
export function Component() {
  const isMounted = useMounted()
 
  return (
    <div>
      <p>{isMounted ? "Component is mounted" : "Component is not mounted"}</p>
    </div>
  )
}

API Reference

Return Values

NameTypeDescription
isMountedbooleanA boolean value indicating if the component is mounted.