title: React Rails Component is not defined
body: <p>I'm trying to get the <a href="https://github.com/reactjs/react-rails" rel="nofollow noreferrer">react-rails gem</a> (version 2.1) working in my Rails 4.2.4 app. I've gone through the setup steps in the Readme and I'm using webpacker for the js preprocessing. I have a component inside of <code>app/javascript/components/label.js</code> that looks like this:</p>
  
  <pre><code>import React, {PureComponent} from 'react';
  import ReactDOM from 'react-dom'
  
  export default class Label extends PureComponent {
  
    render () {
      return (
        &lt;div&gt;Something rendered in React&lt;/div&gt;
      )
    }
  }
  </code></pre>
  
  <p>And then I reference this in my view with the following line: </p>
  
  <pre><code>= react_component("Label")
  </code></pre>
  
  <p>As far as I can see from the Readme, this should be all that is necessary in order to render the component (provided the application pack is included in the layout, which it is)</p>
  
  <pre><code>= javascript_pack_tag 'application'
  </code></pre>
  
  <p>So I'm confused as to why I'm getting the error in my browser that the component is not defined.</p>
  
  <pre><code>Uncaught ReferenceError: Label is not defined
  </code></pre>
  
  <p>Opening <code>app/javascript/packs/application.js</code> I can see the following:</p>
  
  <pre><code>console.log('Hello World from Webpacker')
  // Support component names relative to this directory:
  var componentRequireContext = require.context("components", true)
  var ReactRailsUJS = require("react_ujs")
  ReactRailsUJS.useContext(componentRequireContext)
  </code></pre>
  
  <p>First I verified that the console log is displayed in the browser (it is). I'm not sure what <code>componentRequireContext</code> does, but if it is relative to the current file, then it seems odd that it points to <code>components</code> and not <code>../components</code>, but changing this doesn't render the component. However, I can get the component rendering if I add the following line:</p>
  
  <pre><code>window.Label = require('../components/label.js');
  </code></pre>
  
  <p>I thought the React Rails gem took care of this though, provided the components were saved in the <code>app/javascript/components</code> directory? There's nothing in the Readme that says that I need to explicitly declare and require the component, or am I mistaken?</p>