React JSX working without importing React
<p>I'm trying to run my first React JSX file and it works! However, I don't have these two import statements included in my JSX:</p>

<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
</code></pre>

<p>I thought I would need these two imports so that when the JSX was transpiled to JS (by <code>React.createElement</code>), the React component would be in scope. But it seems to work even without the two imports.</p>

<p>How is it that this works without the imports?</p>

<p>Here is my code:</p>

<p>script.jsx:</p>

<pre><code>var Main = React.createClass({
    getIntialState: function () {
        return {
            counter: 0
        };
    },
    clickHandler: function () {
        return {
            counter: this.state.counter + 1
        };
    },
    render: function () {
        return (
            &lt;button onClick={this.clickHandler}&gt;+2&lt;/button&gt;
        )
    }
});
</code></pre>

<p>package.json </p>

<pre><code>{
  "name": "reactjs",
  "version": "1.0.0",
  "description": "",
  "main": "react.js",
  "dependencies": {
    "webpack": "^1.13.3"
  },
  "devDependencies": {
    "babel-cli": "^6.18.0",
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.8",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "react": "^15.4.1",
    "react-dom": "^15.4.1"
  },
  "scripts": {
   "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
   "dev": "webpack --watch",
   "build": "webpack -p"
  },
  "author": "",
  "license": "ISC"
}
</code></pre>

<p>HTML file</p>

<pre><code>&lt;html&gt;
&lt;head&gt;

    &lt;title&gt;
        !My first React JS Component!
    &lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id="root"&gt;&lt;/div&gt;
    &lt;script src="react.js"&gt;&lt;/script&gt;
    &lt;script src="output.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>webpack.config.js</p>

<pre><code>module.exports = {
    entry: "./app/script.jsx",
    output: {
        filename: "output.js"
    },
    module: {
        loaders: [
            {
                test: /\.(js|jsx)$/,
                loader: 'babel-loader'
            }
        ]
    }
}
</code></pre>