Vercel launched a brand new React part the opposite day — react-tweet. And other people appear to be excited!
What is the deal?
Twitter (or X or Dodge or no matter it is known as tomorrow) has been an absolute mess since Elmo took over. And all of the foolish modifications apart, the modifications to the Twitter ecosystem are fairly unhealthy. New API laws and guidelines affected all the Twitter ecosystem. And sure, I am bitter about all this nonsense (RIP @randomMDN)… However bots and the disillusioned group apart, Twitter was and is a useful data supply for information, tech and all the things occurring on this world.
Suppose you are a blogger; how are you going to embed Tweets in your articles right this moment?
The straightforward resolution is to make use of Twitter’s native embed performance at
publish. Paste a Tweet URL, embed the offered code and also you’re prepared.
This is the Vercel tweet as an embed.
widget), hundreds slowly and has privateness and safety implications. For those who’re a developer, there are higher options!
Again within the day, you might use Twitter’s APIs to fetch Tweets and render them to work across the embed points. When the ecosystem was nonetheless wholesome and functioning, you might create a Twitter app, fiddle with the authentication and fetch all wanted information to render a Tweet. It was cumbersome, but it surely labored.
However what are you able to do now that the ecosystem has been wrecked so badly?
The Vercel launch put up factors to the answer:
The hot button is that Twitter’s authentic
widget talks to an open API at
cdn. This API contains many of the wanted information to render a Tweet in your websites (sadly, retweet depend is unavailable). Reverse engineering the response takes a while however is price it as a result of, as Vercel says, “
Let me inform you a secret… The Tweet above can also be pre-rendered in my 11ty-powered website and makes use of
The place does this deliver us with Tweet embeds? For those who’re utilizing React, go for
react-tweet as a result of Vercel ships high-quality issues. Straightforward-peasy.