zaceno / hyperapp-nestable

Embed apps in other apps, as if they were components
MIT License
40 stars 8 forks source link

Add children to props #1

Closed jonlovera closed 6 years ago

jonlovera commented 6 years ago

Add children to the state so you can pass children to a nestable component

zaceno commented 6 years ago

Hey @jonlov! Nice idea! Just fix the problem I mentioned above (children not in scope) and I'll merge + release :)

jonlovera commented 6 years ago

@zaceno I was playing around a little bit with the plugin and I think we should append the props and children to the state.

What about if we allow people to use the view as on a normal hyperapp ?

Like for example, they could do this:

(state, actions) => { ..... }

or if the want the props and childrens they can use:

(state, actions) => (props, children) => { ...... }
zaceno commented 6 years ago

@jonlov or if the want the props and childrens they can use:

(state, actions) => (props, children) => { ...... }

Interesting.... I'm just starting to experiment with children of nestables myself.

Essentially I'm trying to implement a kind of proof of concept (which I also have a need for): A stateful component which looks like a button in the default state. When clicked, it renders it's children instead of the button. And the children can have a button (or some interaction) which causes them to be hidden again (back to looking like a button).

I'm realizing it might require some sort of idea of context (like React has, as in https://github.com/zaceno/hyperapp-context)

Long story short: I think merging this and saying "we support children" would be short-sighted. I need to think more about how children of nestables should work. You're welcome to help me think though!

I opened an issue where we can continue the discussion.