title: Updating document title without hooks
body: <p>Is it required to use a hook for updating <code>document.title</code>? Is there any advantage to using <code>useEffect</code> vs. just setting the title directly as below?</p>
  
  <p>(This snippet also echoes the title to the console, since you can't see the document title in Stack Snippets, but in my real code I'm just updating the title.)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { useState } = React;
  
  function Example() {
    const [count, setCount] = useState(0);
  
    document.title = `You clicked ${count} times`;
    console.log(document.title);
  
    return (
      &lt;div&gt;
        &lt;p&gt;You clicked {count} times&lt;/p&gt;
        &lt;button onClick={() =&gt; setCount(count + 1)}&gt;
          Click me
        &lt;/button&gt;
      &lt;/div&gt;
    );
  }
  
  ReactDOM.render(&lt;Example /&gt;, document.getElementById('app'));</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"&gt;&lt;/script&gt;
  &lt;script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"&gt;&lt;/script&gt;
  &lt;div id="app"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>(Note: This is the <a href="https://reactjs.org/docs/hooks-effect.html" rel="noreferrer"><code>useEffect</code> example</a> without the <code>useEffect</code> call.)</p>