"use client" import { useRef } from "react" type InitFn = () => T export function useConst(init: T | InitFn): T { const ref = useRef(null) if (ref.current === null) { // @ts-ignore ref.current = typeof init === "function" ? init() : init } return ref.current as T }