Check out example codes for "how to use queryselector with id". It will help you in understanding the concepts better.

Code Example 1

/*Do this for classes*/
document.querySelector(".example"); 
/*Do this for IDs*/
document.querySelector("#example");
/*This selects all of the elements in those groups*/

Code Example 2

<div id="foo\bar"></div>
<div id="foo:bar"></div>

<script>
  console.log('#foo\bar');               // "#fooar" (\b is the backspace control character)
  document.querySelector('#foo\bar');    // Does not match anything

  console.log('#foo\\bar');              // "#foo\bar"
  console.log('#foo\\\\bar');            // "#foo\\bar"
  document.querySelector('#foo\\\\bar'); // Match the first div

  document.querySelector('#foo:bar');    // Does not match anything
  document.querySelector('#foo\\:bar');  // Match the second div
</script>

Code Example 3

document.querySelector("#demo").innerHTML = "Hello World!";

Learn ReactJs, React Native from akashmittal.com