How to activate web share using react-web-share in ReactJS ? Last Updated : 29 Jul, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report Activating Web share using react-web-share in ReactJS enables the sharing of specific data from one webpage/ browser. Using the social share button user can share their content on different social media sites.Prerequisites:React JSNPM and Node.jsApproach: To add our Social Share buttons we are going to use the react-web-share package. The react-web-share package contains UI components that help us add social share buttons. So first, we will install the react-web-share package and then we will add different social share buttons on our homepage using the react-web-share package.Steps to Create React JS Application: Step 1: Initialize a new ReactJs project using the below command:npx create-react-app gfg Step 2: Move to the project directory.cd gfgStep 3: Now we will install the react-web-share package using the below command.npm i react-web-shareProject Structure:The Updated dependencies in package.json file will look like:"dependencies": { "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "react-web-share": "^2.0.2", "web-vitals": "^2.1.4"}Example: This example implements web share functionality to share sample data using the react-web-share library. JavaScript // Filename - App.js import React from "react"; import { RWebShare } from "react-web-share"; export default function WebShareGfg() { return ( <div> <h1>Web Share - GeeksforGeeks</h1> <RWebShare data={{ text: "Web Share - GfG", url: "http://localhost:3000", title: "GfG", }} onClick={() => console.log("shared successfully!") } > <button>Share on Web</button> </RWebShare> </div> ); } Steps to run the application:- Run the below command in the terminal to run the app.npm startOutput: This output will be visible on http://localhost:3000/ on the browser window. Comment More infoAdvertise with us Next Article How to get meta data of files in firebase storage using ReactJS ? I imranalam21510 Follow Improve Article Tags : ReactJS javaScript React-Questions Similar Reads How to get meta data of files in firebase storage using ReactJS ? Within the domain of web development, effective file management is a frequent necessity, and Firebase Storage emerges as a resilient solution. This article explores the nuances of extracting metadata from files housed in Firebase Storage through the lens of ReactJS. PrerequisitesNode JS or NPMReact 2 min read How to save new state to local JSON using ReactJS ? To save data in local storage is a common task while creating a react application to store the user-specific data. We can save new state to local JSON using react in local storage of the browser and access that information anytime later. Prerequisites:React JSNPM & Node.jsJavaScript localStorage 2 min read How to list all the files from firebase storage using ReactJS ? To list all the files from Firebase storage using React JS we will access the Firebase storage using the SDK and display the data on the webpage from the storage.Prerequisites:NPM & Node.jsReact JSFirebaseApproach: To list all the files from Firebase storage using ReactJS we will first configure 3 min read How to add Web Share in Next.js ? The Web Share API enables web applications to share content (like URLs, text, or files) to other apps installed on a user's device, such as social media platforms, messaging apps, or email clients. Integrating the Web Share API into a Next.js project enhances user experience by providing a seamless 2 min read How to add Share button in React Native ? React Native is an open-source UI software framework created by Meta Platforms, Inc. It is used to develop applications for Android, Android TV, iOS, macOS, tvOS, Web, Windows, and UWP by enabling developers to use the React framework along with native platform capabilities.In this article, we will 2 min read How to upload files in firebase storage using ReactJS ? Firebase Storage is a powerful cloud storage solution provided by Google's Firebase platform. It allows developers to store and retrieve user-generated content, such as images, videos, and other files, in a secure and scalable manner. In this article, we will explore how to upload files to Firebase 2 min read Like