fixed share link button
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
export const ShareLinkButton = function ShareLinkButton({props}) {
|
export const ShareLinkButton = function ShareLinkButton({ props }) {
|
||||||
const [text. setText] = useState("Share");
|
const [text, setText] = useState("Share");
|
||||||
|
|
||||||
const onClickHandler = () => {
|
const onClickHandler = () => {
|
||||||
navigator.clipboard.writeText(location.href);
|
navigator.clipboard.writeText(location.href);
|
||||||
setText("Copied to clipboard!");
|
setText("Copied to clipboard!");
|
||||||
|
setTimeout(() => {
|
||||||
|
setText("Share");
|
||||||
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return <button onClick={onClickHandler}>{text}</button>;
|
||||||
<button onClick={onClickHandler}>
|
};
|
||||||
{text}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user