title: how can I use facebook SDK in react
body: <p>I'm currently using react, and by using react-facebook-rogin Library, I successfully made facebook login. However, there is no function for logout!.</p>
  <p>So I decided to use facebook SDK, however I don't know how to use javascript code in react.</p>
  <p>according to facebook official document, I need to write following code in HTML.</p>
  <pre><code>&lt;script&gt;
    window.fbAsyncInit = function() {
      FB.init({
        appId            : 'your-app-id',
        autoLogAppEvents : true,
        xfbml            : true,
        version          : 'v11.0'
      });
    };
  &lt;/script&gt;
  &lt;script async defer crossorigin=&quot;anonymous&quot; src=&quot;https://connect.facebook.net/en_US/sdk.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>And after, this is the code for log out</p>
  <pre><code>FB.logout(function(response) {
    // user is now logged out
  });
  </code></pre>
  <p>And this is the code that I used react-facebook-rogin Library.</p>
  <pre><code>import React from &quot;react&quot;;
  import Navbar from './components/Navbar';
  import { BrowserRouter as Switch, Route } from 'react-router-dom'
  import './components/Navbar.css';
  import './App.css';
  import MainStructure from &quot;./pages/MainStructure&quot;;
  import Study from &quot;./pages/Study&quot;
  import FacebookLogin from 'react-facebook-login'
  import { useState } from &quot;react&quot;;
  
  function App() {
    
    const responseFacebook = (response) =&gt; {
      console.log(response);
      setIsLoggedin(true)
    }
  
    const [isLoggedin, setIsLoggedin] = useState(false);
  
    return (
  
      isLoggedin ?
        (&lt;div&gt;
  
          &lt;Route path='/' &gt;
            &lt;Navbar/&gt;
          &lt;/Route&gt;
  
  
          &lt;Route exact path='/' &gt;
            &lt;MainStructure/&gt;
          &lt;/Route&gt;
  
          &lt;Route path='/study'&gt;
            &lt;Study/&gt;
          &lt;/Route&gt;
        &lt;/div&gt;) 
        :
        (
          &lt;div className=&quot;&quot;&gt;
            &lt;div className=&quot;facebookLogin&quot;&gt;
              &lt;FacebookLogin
                appId=&quot;145617534309548&quot;
                autoLoad={true}
                fields=&quot;name,email,picture&quot;
                //onClick={componentClicked}
                callback={responseFacebook} /&gt;
            &lt;/div&gt;
          &lt;/div&gt;)
  
  
    );
  }
  
  export default App;
  
  </code></pre>
  <p>How can I use javascript code in react code?</p>