zuloonow.blogg.se

Embed tweet inside a tweet
Embed tweet inside a tweet








embed tweet inside a tweet

You can edit it for the next 30 minutes.” /36Ui74ka1kĮarlier this year, Twitter confirmed that it was working on an edit button to test it with its Twitter Blue premium service subscribers. #Twitter keeps working on the EDIT button! It seems tweets are going to be editable only for 30 minutes! The second scenario shows a tweet that’s been edited after the site embedded it the original version will show a “There’s a new version of the tweet” label under the edited tweet with a link to redirect readers to the latest version - on Twitter itself. The first scenario shows a site embedding an already edited tweet with the timestamp of the last edit. Wong presented a couple of scenarios about how embeds and the edit tweet function will work with each other. Well, we now have an idea about how edited tweets might look like when a site embeds them, thanks to app researcher Jane Manchun Wong.Īccording to screenshots she posted this week, embedded tweets will have markers indicating if the author has edited the tweet after the site posted it, keeping the original text intact. Would they dynamically change when edited on Twitter, or would they remain as they were when created? Or would Twitter introduce something radical alongside instead of either of those options? Given how often tweets get embedded elsewhere, the answer to this question takes on nearly philosophical proportions. Adding this function lets us define data that will be fetched at buildtime, and served as static props to the page component.While Twitter hasn’t officially released its much-anticipated edit tweet feature yet, one lingering question has been how they would look as embeds on other sites. Say we have our page component created in NextJS. NextJS makes this entire process easy with getStaticProps. This also reduce calls to Twitter's API, since the tweet data will only be fetched at buildtime. So to replace the Twitter embed iframe, we can fetch and cache the tweet data and deliver it as static content. Instead, it is loaded alongside the webpage itself, and simply consumed within our components. This way, the data does not need to be fetched by the browser after pageload. For webpages displaying static content, we can cache the data powering the webpage and deliver it with the HTML/CSS. The secret to instant page loads is SSR - server-side rendering. Lastly, we need to consume our API function on the page displaying the tweets. Lib/fetchTweets.js export const fetchTweets = async ( tweetIds = ) => M` We'll have this function take in an array of tweet IDs as strings, which we will implement in the next step. We can parse this data for just the content we need to display our tweets on the page. Referencing Twitter's GET /2/tweets /en/docs/twitter-api/tweets/lookup/api-reference/get-tweets API documentation, we will pass tweet IDs to the /2/tweets endpoint as query parameters and receive an array of tweet data in response. For this example, assume the Bearer token is set as an environment variable and fetched using _TOKEN. Once registered, you will create a project and obtain a Bearer token to set in your application. To make the tweet component above dynamic and reusable, we'll need to consume Twitter's API to fetch any tweet by ID, parse the response, and pass the tweet information to the component.įor this, you will need a Twitter account to register at Use Cases, Tutorials, & Documentation /en. 20 Replies 6190 Retweets 32.9K Likes Fetching Tweets from Twitter's API Your success in life depends on your ability to make good decisions.Your happiness depends on your ability to not care about the outcomes. Well, with a few lines of code, we can make a React component that loads instantly, every single time, with the latest statistics, like this: One could suggest simply embedding images of tweets instead - however images are also slow to load, and tweet statistics such as retweets or likes would be stale in the image.

embed tweet inside a tweet

Why not have a static embed for static tweets?

embed tweet inside a tweet

It's quite ironic that for something so static as a tweet ( still waiting for an edit button), the embed process is so dynamic. This is a sub-par experience, since embedded tweets often load many seconds after the page has finished loading. A whole webview is rendered inside the iframe.The page content shifts around to make room. An iframe is initialized, kicking off more JS.The tweet widget JS loads after pageload.But let's face it - despite the platform's ease of use, its embed feature is extremely cumbersome. Twitter is a great way to share thoughts and content.










Embed tweet inside a tweet