useClipboard
Wrapper around navigator.clipboard with feedback timeout
Usage
useClipboard
hook provides interface to work with navigator.clipboard
:
API
useClipboard
hook accepts one argument options
in which copied status timeout duration is defined (defaults to 2000
).
Hook returns object with properties:
copy
– function to copy value to the clipboardcopied
– value that indicates thatcopy
handler was called less thanoptions.timeout
ms agoreset
– function to clear timeout and resetcopied
tofalse
error
– containsError
object if something goes wrong