getElementById in React
<p>Getting this error at the moment:</p>

<p><code>Uncaught TypeError: Cannot read property 'value' of null</code></p>

<p>I call this in my render function below:</p>

<pre><code>&lt;input type="submit" className="nameInput" id="name" value="cp-dev1" onClick={this.writeData}/&gt;
</code></pre>

<p>I also have tried calling it in here</p>

<pre><code>componentWillMount: function(){
        var name = document.getElementById('name').value;
      },
</code></pre>

<p>How can I get the id of an input text field and read that value and ensure it is not null?</p>

<p>I think the DOM is loading after I try to read the element hence why it is null</p>