Javascript Variable Is Not Defined In React Router