Using react-tweet for Embedding X posts
- software
- react
May 9, 202481 views
react-tweet is a new npm package built by Vercel. This allows you to easily embed Tweets into your React applications. For example the following component:
import React from "react";
import { Tweet } from "react-tweet";
const EmbeddedTweet = (props) => (
<div className="flex justify-center ">
<Tweet id={props.id} />
</div>
);
export default EmbeddedTweet;
Will Render the following:
You can find the npm page here: https://www.npmjs.com/package/react-tweet
You can find the official documentation here: https://react-tweet.vercel.app/
You can find the official GitHub here: https://github.com/vercel/react-tweet
This article is just quickly covering the technology I am using to embed tweets on my blog posts, while also testing if it works while integrating it into my Content Management System.