react-use
react-use copied to clipboard
useCopyToClipboard does not work for first time
What is the current behavior?
const [state, copyToClipboard] = useCopyToClipboard();
function handleClick() {
copyToClipboard('hello world')
}
calling copyToClipboard changed the state, but it doesn't really change the actual clipboard
When i paste the clipboard (cmd+v) it shows previous text, not hello world.
After i call copyToClipboard again then it works. so it's kinda lag.
What is the expected behavior?
Works like normal copy to clipboard even for the first time.
Right now i'm using copy to clipboard from usehooks-ts package. it works as expected.
import { useCopyToClipboard } from 'usehooks-ts';
A little about versions:
- OS: Macos
- Browser (vendor and version): Chrome
- React: ^17.0.2
-
react-use: ^17.3.2 - Did this worked in the previous package version? Don't know
I have the same issue