componentDidUpdate vs componentDidMount : <p>I need to make sure an input element is focused when the following is true:</p>

<ul>
<li>the DOM is available and </li>
<li>properties got changed</li>
</ul>

<p>Question: Do I need to put my code in both <code>componentDidUpdate</code> and <code>componentDidMount</code> or just <code>componentDidUpdate</code> would be suffice?</p>

<pre><code>    private makeSureInputElementFocused() {
        if (this.props.shouldGetInputElementFocused &amp;&amp; this.inputElement !== null) {
            this.inputElement.focus();
        }

    }

    componentDidMount() {
        this.makeSureInputElementFocused(); // &lt;-- do i need this?
    }
    componentDidUpdate() {
        this.makeSureInputElementFocused();
    }
</code></pre>
