Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/junqiuzhang/babel-plugin-add-key-for-each-child

add key for each child in list
https://github.com/junqiuzhang/babel-plugin-add-key-for-each-child

babel-plugin children key react

Last synced: 7 days ago
JSON representation

add key for each child in list

Awesome Lists containing this project

README

        

# Babel Plugin Add Key For Each Child
a babel plugin that add key for each react element in list
## Example
**before:**

```
export default (props) => {
const num = [1, 2, 3]
return


{
num.map(o => {
return
})
}

}
```
**after:**

```
export default (props => {
const num = [1, 2, 3];
return


{num.map((o, i) => {
return ;
})}
;
});
```

## Usage
**.babelrc**

```
{
"plugins": [
"@babel/plugin-transform-react-jsx",
"./src/index.js"
]
}
```