Skip to content

How to copy mutable text? #37

@yepyeel

Description

@yepyeel

For example, api like this:

const [isCopied, setCopied] = useClipboard({
  successDuration: 1000,
  defaultCopyText: 'copied text!'
});

// ...
<>
  <span onClick={() => setCopied()}>some text</span> // will be "copied text!"
  <span onClick={() => setCopied('new text!')}>some text</span> // will be "new text!"
</>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions