I am new to ReactJS and encountered an error when using a simple for loop in my code. The error points to the semicolon within the loop, but I'm not sure how to fix it. Here's the code snippet:
const resume = {
interest :['Drawing','Photography','Design','Programming','Computer Science'],
skills :['Web Design with React'],
education :['Wilton High School','Silvermine School of Arts','Codeacademy'],
experience :['Student Technology Intern for Wilton School','Babysitter'],
extracurriculas :['Recycling Club','Gardening Club','Book Club']
}
function App() {
var len = resume.interest.length;
return (
<>
for (let index = 0; index < len; index++) {
<h1>{resume.interest[index]}</h1>
}
</>
)
}
export default App;
The error message I'm getting is: "Parsing error : Unexpected token". It seems that the for loop is causing the issue, specifically the semicolon. How can I resolve this error and successfully loop through the resume.interest array to display each interest as an element? This above code throw error like that:Screenshot of error
But it works when I did
<h1>{resume.interest[0]}</h1>
without for loop