
I built a 400B clipboard library for React (with an agnostic core)
🚀 I built a 400B clipboard library for React (with an agnostic core) Copying to the clipboard sounds simple… until you try to do it properly. Permissions, async APIs, browser quirks, and UI feedback quickly turn something that should be one line into unnecessary boilerplate. So I built lite-clipboard . What is lite-clipboard? lite-clipboard is a tiny, zero-dependency clipboard library with a framework-agnostic core and a React hook on top. Use the core anywhere (vanilla JS, Vue, Svelte, etc.) Use the hook for a clean React experience React usage import { useClipboard } from ' lite-clipboard ' ; function CopyButton ({ text }) { const { copied , copy } = useClipboard (); return ( < button onClick = { () => copy ( text ) } > { copied ? ' Copied! ' : ' Copy ' } </ button > ); } Simple, reactive, and no boilerplate. Framework-agnostic core If you're not using React: import { copy } from ' lite-clipboard/core ' ; await copy ( " Hello world " ); No framework required. Why another clipboard li
Continue reading on Dev.to React
Opens in a new tab



