docs: fix key anti-pattern snippet (#1577)
This commit is contained in:
parent
37b38f5822
commit
c12b3e8fc2
1 changed files with 3 additions and 1 deletions
|
|
@ -106,9 +106,11 @@ var Button = {
|
||||||
return m("button", {key: vnode.attrs.id}, u.name)
|
return m("button", {key: vnode.attrs.id}, u.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PREFER
|
||||||
users.map(function(u) {
|
users.map(function(u) {
|
||||||
return m("div", [
|
return m("div", [
|
||||||
m(Button, {id: u.id}, u.name) // key should be here, not in component
|
m(Button, {key: u.id}, u.name) // key should be here, not in component
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue