hyperapp-context icon indicating copy to clipboard operation
hyperapp-context copied to clipboard

Do we need that in 2.0?

Open 11111000000 opened this issue 6 years ago • 1 comments

11111000000 avatar Sep 26 '19 09:09 11111000000

Same as with hyperapp-nestable: I'm toying lightly with ideas for stateful components and context. If I figure something out I'll update this and nestable.

If what you need is a replacement to the "subview" feature of Hyperapp v1, which gave access to the global state in any component, without needing to pass props down, then have a look at this gist I made a year ago:

https://gist.github.com/zaceno/aef8cb759e44616536d52479b25ba60e

It worked fine then, and I think it still should but haven't tested recently.

Basic usage:

const {h, app} = hyperapp

const SubView = view(state => <h1>Hello {state.message}</h1>)

withViews(app)({
  init: {message: 'World'},
  view: state => <body><SubView /></body>,
  node: document.body,
})

zaceno avatar Sep 27 '19 12:09 zaceno