Is there a way to loop through an array in React using useState