From 44b46108bf726c2a387330643ef67593edc98d9f Mon Sep 17 00:00:00 2001 From: Cohan Carpentier Date: Tue, 12 Nov 2024 22:25:31 -0500 Subject: [PATCH] fix: readd useismounted --- README.md | 2 +- hooks/use-is-mounted.ts | 13 +++++++++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 hooks/use-is-mounted.ts diff --git a/README.md b/README.md index a359902..c149eaa 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | -| ![Statements](https://img.shields.io/badge/statements-40.69%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.71%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-73.8%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-40.69%25-red.svg?style=flat) | +| ![Statements](https://img.shields.io/badge/statements-40.43%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-78.57%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72.09%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-40.43%25-red.svg?style=flat) | diff --git a/hooks/use-is-mounted.ts b/hooks/use-is-mounted.ts new file mode 100644 index 0000000..6efa190 --- /dev/null +++ b/hooks/use-is-mounted.ts @@ -0,0 +1,13 @@ +"use client"; + +import { useEffect, useState } from "react"; + +export function useIsMounted() { + const [isMounted, setIsMounted] = useState(false); + + useEffect(() => { + setIsMounted(true); + }, []); + + return isMounted; +} diff --git a/package.json b/package.json index 8f7b5d4..7148bf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@risc0/ui", - "version": "0.0.214", + "version": "0.0.215", "private": false, "sideEffects": false, "type": "module",