
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-use-clipboard
Advanced tools
A React Hook that provides copy to clipboard functionality.
You can install react-use-clipboard
with NPM or Yarn.
npm install react-use-clipboard --save-exact
yarn add react-use-clipboard --exact
We encourage pinning the version number until react-use-clipboard
reaches 1.0.0
. We may ship breaking changes in 0.x.x
versions.
Here's how to use react-use-clipboard
:
import useClipboard from "react-use-clipboard";
function App() {
const [isCopied, setCopied] = useClipboard("Text to copy");
return (
<button onClick={setCopied}>
Was it copied? {isCopied ? "Yes! 👍" : "Nope! 👎"}
</button>
);
}
You can reset the isCopied
value after a certain amount of time with the successDuration
option.
import useClipboard from "react-use-clipboard";
function App() {
const [isCopied, setCopied] = useClipboard("Text to copy", {
// `isCopied` will go back to `false` after 1000ms.
successDuration: 1000
});
return (
<button onClick={setCopied}>
Was it copied? {isCopied ? "Yes! 👍" : "Nope! 👎"}
</button>
);
}
This package only works in versions of React that support Hooks.
FAQs
React hook that provides copy to clipboard functionality.
The npm package react-use-clipboard receives a total of 28,599 weekly downloads. As such, react-use-clipboard popularity was classified as popular.
We found that react-use-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.