In react when using jsx, you can nest components by using props.children.
Is this possible with hyperapp? I've tried doing it in my views but it isn't working the way I'd expect it to.
For example, this does not work as intended:
const { h, app } = hyperapp
/** @jsx h */
const Foo = ({ children }) => (
<div>
hello {children}
</div>
)
app({
view: _ => <Foo>world</Foo>
})
/* view should return <div> hello world </div> */
@traducer In react when using jsx, you can nest components by using props.children.
In HyperApp, the signature of a component function is as follows: (data, children).
If there are no children, an empty array is passed.
[[Source](https://github.com/hyperapp/hyperapp/blob/master/src/h.js#L14)]
Perhaps you want this?
const Foo = (props, children) =>
<div>
hello {children}
</div>
@jbucaran, awesome explanation, thank you.
I used choo quite a bit, so being able to use different virtual dom builders is nice.
@traducer Choo is very nice too. Thanks! :)
Most helpful comment
In HyperApp, the signature of a component function is as follows:
(data, children).If there are no children, an empty array is passed.
[[Source](https://github.com/hyperapp/hyperapp/blob/master/src/h.js#L14)]
Perhaps you want this?