How to Embed a LinkedIn Feed in React or Next.js
In React or Next.js, render the widget placeholder in your component and load the embed script once. Call the mount function after client-side navigation to render new widgets.
Step-by-step: add a LinkedIn widget to React & Next.js
- 1
Create your LinkedIn widget
Sign up for free, click New widget, choose Person or Company, and paste your LinkedIn profile or company page URL.
- 2
Customize and copy the embed code
Pick a widget (posts feed, profile card, company page, certifications or projects), match your brand, then open the Integration tab and copy the code.
- 3
Render the placeholder
Add the widget <div> to your component, using className instead of class and the data-widget-id attribute from your embed code.
- 4
Load the script once
Load embed.js once, for example with Next.js <Script src=".../embed.js" strategy="lazyOnload" />. After client-side route changes, call window.LinkedEmbed?.mount() to render new placeholders.
Your embed code looks like this
Copy the exact code, with your widget ID, from the Integration tab in the LinkedEmbed dashboard.
<div class="linkedembed-widget" data-widget-id="YOUR_WIDGET_ID"></div>
<script src="https://www.linkedinembed.com/embed.js" async></script>Tips for React & Next.js
- The widget runs in an isolated iframe, so your app's CSS never conflicts with it.
- For server-rendered pages, the iframe snippet works without any JavaScript.
Ready to add LinkedIn to React & Next.js?
Create your widget for free and get your embed code.
LinkedIn on React & Next.js: FAQ
Is there an npm package?
Not yet. The embed script is a tiny standalone file, so a package isn't required.
Does it work with the Next.js App Router?
Yes. Render the placeholder in any component and load the script with next/script.
Which LinkedIn widget will you add to React & Next.js?
Every widget uses the same embed code, so the steps above work for all of them.
Put your LinkedIn on your website today
Create your first widget in about two minutes. Free plan, no credit card required.