Skip to content

Bug: This isn't a bug but a feature request  #20467

Closed
@phtom

Description

@phtom

React version: 17

This isn't a bug but a feature request that many devs would like to see in react including me.
For many times we have to use map funtion to loop items in a array just like the following:

exampleArray.map((index) => ( <motion.li key={index} className="item" variants={item} /> ))}

The sample above works great when we want to map an object, group of objects or arrays. There are some cases where we would like to do different. For example, in the code bellow I want inside JSX to loop 6 times a line of code:

{[0, 1, 2, 4, 5].map((index) => ( <motion.li key={index} className="item" variants={item} /> ))}

The code above seems off, we should be able to make a for cycle inside JSX. I would like to repeat the line 6 times to create 6 circles.

Do you think in future versions we could do it? Using this way doesn't seem great.

I wrote here because I didn't see any link pointing to feature or improvement request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions