@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
17 lines (16 loc) • 433 B
JavaScript
import { useCallback, useState } from "react";
const useClipboard = ({ duration = 3000 } = {})=>{
const [copied, setCopied] = useState(false);
const copy = useCallback(async (value)=>{
await navigator.clipboard.writeText(value);
setCopied(true);
setTimeout(()=>setCopied(false), duration);
}, [
duration
]);
return {
copied,
copy
};
};
export { useClipboard };