Javascript Validate Text Input Onchange Function In React