useConst
Returns a constant value initialized once.
Usage
import { useConst } from "@siberiacancode/reactuse";
const value = useConst("value");Example
const id = useConst(() => crypto.randomUUID());
const config = useConst(() => ({ retry: 2 }));
return (
<div>
{id} (retry: {config.retry})
</div>
);Type Declarations
export declare const useConst: <Value>(
initialValue: (() => Value) | Value
) => Value;