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

Code clarity #141

Open
FelipeSharkao opened this issue Sep 26, 2021 · 0 comments
Open

Code clarity #141

FelipeSharkao opened this issue Sep 26, 2021 · 0 comments

Comments

@FelipeSharkao
Copy link

FelipeSharkao commented Sep 26, 2021

I've tried writing, by the documentation:

const fooInput = () =>
  go(function* () {
    const { value } = yield e.input()
    const { click } = yield e.button('Insert')

    return { insert: snapshot(value, click) }
  })

That wouldn't work, both values was undefined, so I need to do:

const fooInput = () =>
  go(function* () {
    const { value } = yield e.input().use({ value: 'value' })
    const { click } = yield e.button('Insert').use({ click: 'click' })

    return { insert: snapshot(value, click) }
  })

That's already very redundant. But still, I couldn't access insert from other components, so what I ended up doing was:

const fooInput = () =>
  component(o =>
    go(function* () {
      const { value } = yield e.input().use({ value: 'value' })
      const { click } = yield e.button('Insert').use({ click: 'click' })

      return { insert: snapshot(value, click) }
    }).output({ insert: o.insert })
  )

Am I missing something? Or is it that chain can never catch available observables that weren't remapped with use, and go won't output them, even with the last line it telling so? Am I misusing go when it is supposed to be something else?

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

1 participant