15 lines
321 B
TypeScript
15 lines
321 B
TypeScript
|
export const ShareLinkButton = function ShareLinkButton({props}) {
|
||
|
const [text. setText] = useState("Share");
|
||
|
|
||
|
const onClickHandler = () => {
|
||
|
navigator.clipboard.writeText(location.href);
|
||
|
setText("Copied to clipboard!");
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<button onClick={onClickHandler}>
|
||
|
{text}
|
||
|
</button>
|
||
|
)
|
||
|
}
|