Skip to content
 
 

Repository files navigation

react-x-embed

Embed X (Twitter) posts in React. No API key, no iframe, no client-side JavaScript required.

View the docs for react-x-embed ->

A fork of vercel/react-tweet that fixes the outstanding crashes, matches X's own embed layout, and renders the data the syndication API returns but upstream ignored.

pnpm add react-x-embed
import { Tweet } from 'react-x-embed'

export default function Page() {
  return <Tweet id="1628832338187636740" />
}

See the package readme for what changed and why, or the docs to get started.

Repository layout

Path Description
packages/react-x-embed The library
apps/site Documentation site
apps/next-app Next.js test app — App Router, Pages Router, SWR, caching
apps/vite-app Vite test app
apps/custom-tweet-dub Custom theme example

Development

pnpm install
pnpm dev --filter=next-app...   # test app on :3001
pnpm test --filter=react-x-embed

Tests run against captured syndication payloads in packages/react-x-embed/test/fixtures, so they need no network access. That directory also holds X's own rendered HTML, CSS, and computed geometry for the same tweets — the reference layout decisions are measured against.

License

MIT. Originally created by Luis Alvarez at Vercel.

About

Embed tweets in your React application.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages