SukkaW / foxact

React Hooks/Utils done right. For Browser, SSR, and React Server Components.
https://foxact.skk.moe
MIT License
316 stars 12 forks source link

Error: [foxact] useClipboard: navigator.clipboard is not supported #5

Closed tohsaka888 closed 1 year ago

tohsaka888 commented 1 year ago

Hi,i am using foxact.

I deploy my web app using docker in private server.When i want to copy something using useClipboard, i got an error.

Error: [foxact] useClipboard: navigator.clipboard is not supported

How can i fix it?

SukkaW commented 1 year ago

It seems that the browser has blocked access to the navigator.clipboard API.

You can enable manual copy fallback with the option usePromptAsFallback:

const { copy, error } = useClipboard({ usePromptAsFallback: true });

With this option, foxact will attempt to use window.prompt to provide a fallback.

tohsaka888 commented 1 year ago

Thanks!!!