Skip to content

Commit 2e75897

Browse files
committed
Address some feedback around naming and (indirectly) m.key, optimize m.use
`m.use` is specially designed to be used a fair amount, and simulating it is relatively slow, so it's worth making a built-in. `m.key` -> `m.keyed` provides for a simpler interface, one that you don't have to type `key` out explicitly for anymore. (Most frameworks require you to explicitly add a "key" attribute, while this approaches it more like a glorified `Map`.)
1 parent 36d4cb3 commit 2e75897

22 files changed

+1127
-692
lines changed

performance/components/shuffled-keyed-tree.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,5 @@ function shuffle() {
1717

1818
export const shuffledKeyedTree = () => {
1919
shuffle()
20-
var vnodes = []
21-
for (const key of keys) {
22-
vnodes.push(m.key(key, m("div.item")))
23-
}
24-
return vnodes
20+
return m.keyed(keys, (key) => [key, m("div.item")])
2521
}

0 commit comments

Comments
 (0)