How to create Web share in NextJS ?


 npm i react-web-share

 import { RWebShare } from "react-web-share";
 
<RWebShare
   data={{
   text: "NextJS1",
   url: "http://localhost:3000",
   title: "Nextjs Project1",
   }}               
   ><button>Share on Web</button>
</RWebShare>

 

*****************************************************

 

 

npx create-react-app gfg

import {
  FacebookShareButton,
  FacebookIcon,
  PinterestShareButton,
  PinterestIcon,
  RedditShareButton,
  RedditIcon,
  WhatsappShareButton,
  WhatsappIcon,
  LinkedinShareButton,
  LinkedinIcon,
} from 'next-share';

<div>
  <FacebookShareButton url={'http://localhost:3000'} >
    <FacebookIcon size={32} round />
  </FacebookShareButton>
  <PinterestShareButton  url={'http://localhost:3000'} >
    <PinterestIcon size={32} round />
  </PinterestShareButton>
  <RedditShareButton  url={'http://localhost:3000'} >
    <RedditIcon size={32} round />
  </RedditShareButton>
  <WhatsappShareButton  url={'http://localhost:3000'} >
    <WhatsappIcon size={32} round />
  </WhatsappShareButton>
  <LinkedinShareButton url={'http://localhost:3000'} >
    <LinkedinIcon size={32} round />
  </LinkedinShareButton>
</div>

 

Comments