Block State Destructuring & Nesting
sxzz opened this issue · 2 comments
sxzz commented
const n0 = _createFor(
() => source,
(state) => {
// ^ state === block.s
const [{ a, ...other }, index, key] = state
return { a, other, index, key }
},
(_ctx2) => {
// ^? ShallowReactive
on(element, () => _ctx2.other)
renderEffect(() => {
_setText(n2, _ctx2.a)
})
const n1 = _createFor(
() => source2,
(state) => {
const [item] = state
return { item }
},
(_ctx3) => {
console.log(_ctx2.a, _ctx3.item)
},
)
return n0
},
)LittleSound commented
this is also a prerequisite for slots props
LittleSound commented
Use withDestructure in PR #221 to implement destructuring assignment.
Use scopeLevel in PR #223 to implement nesting scopes