Skip to content

Block State Destructuring & Nesting #204

Closed
@sxzz

Description

@sxzz
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
  },
)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions