Check out example codes for "how to innerhtml is empty". It will help you in understanding the concepts better.

Code Example 1

element.innerHTML.length == 0 ? element.appendChild(createdEl) : (element.innerHTML = '', modalNote.appendChild(createdEl));

Learn ReactJs, React Native from akashmittal.com