JSPM

use-clipboard-hook

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 488
  • Score
    100M100P100Q92288F
  • License MIT

Copy to clipboard React hook.

Package Exports

  • use-clipboard-hook

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-clipboard-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

use-clipboard

Copy to clipboard React hook.

NPM JavaScript Style Guide

Install

npm install --save use-clipboard

Usage

import * as React from "react";

import { useClipboard } from "use-clipboard";

const Example = () => {
  const [inputRef, onClick] = useClipboard({
    onCopy: (text) => console.log(`Copied: ${text}`),
  });
  return (
    <div>
      <input ref={inputRef} defaultValue="Change this..." />
      <button onClick={onClick}>copy</button>
    </div>
  );
};

Live Demo

License

MIT © fayeed


This hook is created using create-react-hook.