Closed yisar closed 4 years ago
const node = document.getElementById("app") const setState = state => { patch( node, h("div", {}, state && h("h1", {}, 'hello'), h("button", { onClick: () => setState(!state) }, "x") ) ) } setState(true)
I‘d seen that only keyd elements can be cached and reused, and elements like this are still completely updated. In fact, the following use case only needs to insert or remove hello
hello
What do you think of this?
Insertions are difficult and in some cases impossible to optimize without keys, so use keys -- that's one of the reasons they exist.
I‘d seen that only keyd elements can be cached and reused, and elements like this are still completely updated. In fact, the following use case only needs to insert or remove
hello
What do you think of this?