Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React-components: Use own clipboard implementation #144

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

donskov
Copy link
Collaborator

@donskov donskov commented Mar 5, 2024

Fix #143

< 0.6.0

const Demo = () => {
  const {
    onCopy,
    hasCopied,
  } = useClipboard('Text to copy');

  return (
    <button
      type="button"
      onClick={onCopy}
    >
      {hasCopied ? 'Copied' : 'Click to copy'}
    </button>
  );
};

>= 0.6.0

const Demo = () => {
  const { copy, isCopied } = useClipboard();

  return (
    <button
      type="button"
      onClick={() => copy('Text to copy')}
    >
      {isCopied ? 'Copied' : 'Click to copy'}
    </button>
  );
};

@donskov donskov self-assigned this Mar 5, 2024
@donskov donskov merged commit 8b58cff into main Mar 5, 2024
1 check passed
@donskov donskov deleted the donskov/fix-143 branch March 5, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useClipboard hook doesn't work with native dialogs
2 participants