Hyperapp throws "length of undefined" when the child component returns an array
See original GitHub issueI have a Parent component that takes a bunch of children elements and simply returns them. Hyperapp throws length of undefined in the createElement
function.
Codepen: https://codepen.io/rajaraodv/pen/VMqBNB Note:
- This only happens if the main Parent component is not itself wrapped in something but is the main/direct element for the
view
function. - If I wrap the children array in {children} then the resulting DOM shows
<undefined>...children elements... </undefined>
Expected: It should render the children elements.
const { h, app } = hyperapp;
/** @jsx h */
const Parent = ({ state, actions }, children) => {
return children; //<-- returning w/o "{" "}" causes error in Hyperapp
};
app({
state: {
count: 0
},
view: (state, actions) => (
<Parent state={state} actions={actions}>
<h1>raja</h1>
<h2> rao</h2>
</Parent>
)
});

Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Cannot read property 'length' of undefined when trying to get ...
I am trying to render the number of players from my players JSX to my app but keep getting Cannot read property 'length'...
Read more >Typeerror: Cannot Read Property 'length' of Undefined
Return the number of elements inside of an array with Array.prototype.length . Find out the number of arguments passed into a function with ......
Read more >Beginning Functional JavaScript - Springer Link
array elements, right? It looks like we are telling the compiler what to do, however. In this case, we are telling the compiler,...
Read more >30 seconds of interviews
A curated collection of common web development interview questions to help you prepare for your next interview.
Read more >angular/angular - Gitter
How can I lazy load the child module in my super application? ... the subscriber's onNext returns an array of the results from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a known limitation of hyperapp. Components may return arrays, but
view
specifically may notYeah, probably moving this to #417 is a good idea since there is nothing Hyperapp can do other than warn people.