Embed tweets into your React application without sacrificing performance.
Introducing react-tweet β embed tweets into any React application with a single line of code, without sacrificing performance.
import { Tweet } from 'react-tweet'
export default function Page ( ) {
return < Tweet id = "1683920951807971329" / >
}
The resulting tweet β statically generated, no iframes required:
Some benefits of using react-tweet :
35x less client-side JavaScript than the Twitter's Native embed
Support for React Server Components
Built-in data fetching and caching
Works with any React framework β Next.js , Vite, and Create React App
Link to heading Improving embeds with Server Components
Historically, embedding tweets has required using Twitter's embedded iframe . This loads 560kb worth of client-side JavaScript, which slows site performance and causes layout shift.
With react-tweet , you no longer need to use iframes.β¦