
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
react-elfsight-widget
Advanced tools
The package provides a component that helps smoothly integrate an Elfsight widget into a React app.
Please note that to use it you need an Elfsight account and a widget created and configured.
npm i react-elfsight-widget
import { ElfsightWidget } from 'react-elfsight-widget';
function MyComponent() {
<ElfsightWidget widgetId={/* replace with a widget id */} lazy />;
}
In case you need any assistance, please contact support.
Widget identifier.
Let's take a look at an arbitrary installation code.
<script src="https://static.elfsight.com/platform/platform.js" defer></script>
<div class="elfsight-app-85d18ddb-c202-421e-9a88-6c099d7a7833"></div>
At the second line we can see a div
element with a long class name: elfsight-app-85d18ddb-c202-421e-9a88-6c099d7a7833
, where 85d18ddb-c202-421e-9a88-6c099d7a7833
is the widget identifier.
So, in order to obtain a widget identifier you need'll to take it's class name and strip elfsight-app-
prefix.
Enables lazy loading. Accepts boolean or string (useful when you want to specify a lazy loading mode). If no mode is specified then a widget will be loaded either once it's in the viewport or after user's first activity.
Modes:
Also you can pass any prop that standard div
element accepts such as className
, id
, style
and others. All these props will be forwarded to a widget container div
element.
FAQs
The right way to add Elfsight Widget to your React App
We found that react-elfsight-widget demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.