useTimeout

Custom hook that handles timeouts in React components using the setTimeout API.

Usage

import { useState } from "react";
import { useTimeout } from "@teasim/hooks";
export default function Component() {
const [visible, setVisible] = useState(true);
const hide = () => {
setVisible(false);
};
useTimeout(hide, 5000);
return (
<div>
<p>{visible ? "I'm visible for 5000ms" : "You can no longer see this content"}</p>
</div>
);
}