useCopyToClipboard should reset its status after a while
Is your feature request related to a problem? Please describe.
Problem: useCopyToClipboard has no reset functionality - once copied, the hook stays in completed state forever.
Describe the solution you'd like
This isn't regular UX that I encounter on the web. Instead the hook would rather stay in completed for a few secs then reset.
Update: some reset it based on user interaction
So how about backward-compatible:
const state = useCopyToClipboard(timeoutMS)
and/or
const { reset, ...state} = useCopyToClipboard()
and then
<div onMouseOut={reset} />
Describe alternatives you've considered
I don't know - is there a simple way to achieve this that I'm missing? Otherwise I'm considering a PR if that's welcome.
In the PR I've settled with this format since it's the generic one:
const [state, copyToClipboard, reset] = useCopyToClipboard()
@streamich any feedback on this or the PR?
does this project still welcome PRs and issues @xobotyi?
+1 on this issue.
+1 good idea
+ 1
+1