Allow h to receive children as the second argument.
See original GitHub issueIf this involves a lot of code, then the benefit will not balance the bundle size increase tradeoff, otherwise it would be nice to have.
Instead of:
h("h1", {}, "Hello")
Allow h to work like this too:
h("h1", "Hello")
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
React Children And Iteration Methods - Smashing Magazine
In this article, we'll discuss and learn about the use case of iterating over React `children` and the ways to do it. In...
Read more >How to pass props to {this.props.children} - Stack Overflow
Cloning children with new props. You can use React.Children to iterate over the children, and then clone each element with new props (shallow...
Read more >Children as second argument out of line with API · Issue #2 ... - GitHub
Isn't this out of step with the React API where children is on the props ... jsx-pragmatic will accept undefined returned from a...
Read more >How to pass data to a React component's props.children
In the above example, the <Link> component will receive a children function that expects to be called with a single argument: isActive ....
Read more >Children - React Docs
It will be called with the child as the first argument and its index as the second argument. The index starts at 0...
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
@lukejacksonn Remember than JSX/Hyperx is transformed into h calls in your dist/bundle.
Some people think a good reason to use vanilla h is to “avoid” a build pipeline, but you are still going to bundle assets and uglify the code anyway, so using pure h calls does not remove the need of a build setup, it just mitigates some of the overhead of using so much tooling.
But, like I said above, if this fix does not entail a lot of code, then why not just make the data optional. I’ve added this to the 0.6.0 milestone.
Closing as won’t fix! 😄