Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block State Destructuring & Nesting #204

Open
sxzz opened this issue May 9, 2024 · 1 comment
Open

Block State Destructuring & Nesting #204

sxzz opened this issue May 9, 2024 · 1 comment
Assignees

Comments

@sxzz
Copy link
Member

sxzz commented May 9, 2024

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
Copy link
Member

this is also a prerequisite for slots props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants