How to integrate the Twitter widget into Reactjs?

前端 未结 9 2387
我在风中等你
我在风中等你 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:26

    First load Widget JS in your index.html(before your React scripts). Then in your component, simply do the following. The widget JS will rescan the DOM.

    componentDidMount: function() {
      twttr.widgets.load()
    }
    

    See: https://dev.twitter.com/web/javascript/initialization

提交回复
热议问题