useShare()

description

  • hook returns an object with event handlers

demo

code

const Demo = () => {
   const { Facebook, X, LINE, share, copy, isCopied } = useShare({
      shareUrl: "url",
   });
   return (
      <div className={s.buttons}>
         <button {...copy} className={isCopied ? s.copied : ""}>
            copy
         </button>
         <button {...X}>Twitter/X</button>
         <button {...share}>instagram</button>
         <button {...Facebook}>facebook</button>
         <button {...LINE}>LINE</button>
      </div>
   );
};