mlmorg / react-hyperscript

Hyperscript syntax for React.js markup
MIT License
710 stars 45 forks source link

Add support for render props #41

Closed arturmuller closed 1 year ago

arturmuller commented 6 years ago

Hey there!

This PR makes a tiny change make usage of render props a bit easier. Render props seems to be all the rage right now and with the upcoming React 16.3 context API, they have essentially been "blessed" by the core React team.

This PR make this possible:

h(Context.Consumer, context => { ...})

Whereas previously it was necessary to step over null:

h(Context.Consumer, null, context => { ...})

Implications:

If some of your users do something like:

function foo() {}
foo.bar = "baz"

const element = h("div", foo)

...and expect element.props to be {bar: "baz"}, this change will break their code. For this reason this could/should be considered a breaking change.

Test are updated and passing, README has been updated.