Javascript Substring Is Not A Function React