Loop inside React JSX

clock icon

asked 9 months agoAsked

message

0Answers

eye

42Views

I'm trying to do something like the following in React JSX (where ObjectRow is a separate component):

<tbody>
    for (var i=0; i < numrows; i++) {
        <ObjectRow/>
    } 
</tbody>

I realize and understand why this isn't valid JSX, since JSX maps to function calls. However, coming from template land and being new to JSX, I am unsure how I would achieve the above (adding a component multiple times).

0 Answers

Write your answer here

Top Questions

    Made with by Haseeb Yousuf