title: Cannot set properties of null in React
body: <p>I have two elements that are supposed to appear depending on whether the condition is true or false but on one of them I need to use <code>useRef</code> hook but it doesn't work. Even though the element sometimes renders first, I still get the error <code>Cannot set properties of null</code>. I need to edit the second element's value when it renders with its reference but the code crashes so I can't do anything. Code looks like this:</p>
  <pre><code>inputRef.current.value=&quot;Some text&quot;
  {condition ? &lt;SomeOtherComponent /&gt; : &lt;input type=&quot;text&quot; ref={inputRef} /&gt;}
  </code></pre>