Integrating Facebook Web SDK with ReactJS Component State : <p>I'm getting started with ReactJS, NodeJS, Webpack, and the Facebook SDK for user authentication.  All these technologies and their associated software engineering principles/best practices are relatively new to me (even JavaScript is pretty new to me).</p>

<p>I've followed the tutorial here <a href="https://developers.facebook.com/docs/facebook-login/web" rel="noreferrer">https://developers.facebook.com/docs/facebook-login/web</a> and I've got Facebook authentication working great!  But the way this tutorial content is structured, it looks to me like the SDK is designed only to expect the FB status response handlers to be included in the raw page HTML just inside the <code>&lt;body&gt;</code> tag.  The following in particular references this:</p>

<pre><code>  // Load the SDK asynchronously
  (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</code></pre>

<p>This strategy strikes me as imperfect and hard to integrate with React components.  Is there a way to relocate the Facebook login/authentication code and Facebook status update handlers from the HTML, for example, into scripts being bundled with React code via Webpack?  Is it possible?  Part of the reason for my question is that if I understand correctly, for my Facebook status update handler to be able to update my React components' state, that handler needs to be part of a component to have access to the relevant React component <code>this.setState(...)</code> function.</p>

<p>Am I even thinking about this correctly?</p>
