Check out example codes for "monitoring serial ports with cmd". It will help you in understanding the concepts better.

Code Example 1

SerialMonitor.EXE /new   
   PORT
   [A] [T] [L] [R] [D]
      
      /*
      “PORT” defines the serial port to monitor (COM1, COM4, etc.)
      “A” means that monitoring should be started automatically once you press the “Enter” button
      “T” means that “Table View” should be toggled on
      “L” means that “Line View” should be toggled on
      “R” means that “Terminal View” should be toggled on
      “D” means that “Data View” should be toggled on
      */

SerialMonitor.exe /new COM1 ATLRD

Learn ReactJs, React Native from akashmittal.com