How to integrate the Twitter widget into Reactjs?

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

    This works for me!

    Please note that I use React v0.14 and ECMAScript 2015 (aka ES6) with Babel.

    index.html (after body tag):

    
    

    Twitter component:

    const Twitter = () => (
      
      
    );
    

    Some React Component (that uses Twitter button):

    class SomeReactComponent extends Component {
      constructor(props) {
        super(props);
      }
    
      render() {
        return (
          
    ); } }

    Or if you want to have a customized button, you can simply do this:

    const Twitter = () => (
      
        
      
    );
    

提交回复
热议问题