Check out example codes for "remove validation error after it has been corrected in html". It will help you in understanding the concepts better.

Code Example 1

if (!validateUsername())
    {
        document.getElementById('uname').innerHTML = "Please enter a username";
    }else {
        document.getElementById('uname').innerHTML = "";
    }

Learn ReactJs, React Native from akashmittal.com