How to integrate the Twitter widget into Reactjs?

前端 未结 9 2364
我在风中等你
我在风中等你 2021-02-18 20:33

I want to add the Twitter widget into React, but I don\'t know where to start or how to do it. I am very new to React JS.

Here is the HTML version of the code:

9条回答
  •  臣服心动
    2021-02-18 21:02

    Try to install the react-twitter-embed by doing npm install react-twitter-embed. Once installed, the usage is pretty simple. Take a look at the screenshot below.

    Code Sample:

    import React from 'react';
    
    import { TwitterTimelineEmbed } from 'react-twitter-embed';
    
    const TwitterTimeLine = () => {
    
      return (
        
      );
    }
    
    export default TwitterTimeLine;
    

    They also have a list of other components that you can use as well.

    List of available components

    • TwitterShareButton
    • TwitterFollowButton
    • TwitterHashtagButton
    • TwitterMentionButton
    • TwitterTweetEmbed
    • TwitterMomentShare
    • TwitterDMButton
    • TwitterVideoEmbed
    • TwitterOnAirButton

    Here is a link to the npm package https://www.npmjs.com/package/react-twitter-embed

提交回复
热议问题