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

Use clipboard imperative usage #7761

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kristian240
Copy link
Contributor

Closes #7754

📝 Description

Added possibility to call copy from useClipboard imperatively.

⛳️ Current behavior (updates)

To pass in a value that is obtained imperatively, e.g. prompt or value from a global object, you would need to either rely on useEffect and violate chains of computations or in SSR do a two-pass render to get access to the global object.

🚀 New behavior

By calling the useClipboard without value arguments, i.e. no arguments on only optionsOrTimeout argument you are able to pass in value to onCopy callback.

💣 Is this a breaking change (Yes/No): No

📝 Additional Information

I will link docs PR here as well once I create it.


Hey @segunadebayo! Here is the PR. Please checkout other feat commits as I had multiple ideas on how to solve the DX. I find this the best, but I would like to hear your opinion on this one.

@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2023

⚠️ No Changeset found

Latest commit: 64efb8a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jun 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
chakra-ui-storybook ✅ Ready (Inspect) Visit Preview Jun 13, 2023 7:45pm

@vito
Copy link

vito commented Apr 19, 2024

It looks like the docs for this were merged, but not the feature itself 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[useClipboard] Allow imperative usage
2 participants