reasonml / reason-react

Reason bindings for ReactJS
https://reasonml.github.io/reason-react/
MIT License
3.25k stars 349 forks source link

ppx: support "custom children" in uppercase components without having to wrap in array literal #823

Open jchavarri opened 11 months ago

jchavarri commented 11 months ago

Fixes #822.

The breaking change is for uppercase components that were introspecting with React.Children. After the change, these components would need to run children through React.array.

It allows to write:

<Test> {Test.name: "foo"} {name: "bar"} </Test>

besides the already possible:

<Test> [|{Test.name: "foo"}, {name: "bar"}|] </Test>
jchavarri commented 10 months ago

@davesnx what are your thoughts on this?

I wonder if we should mention this difference between uppercase / lowercase components in our documentation.

@anmonteiro We do mention something already:

Do you mean to expand on that?

anmonteiro commented 10 months ago

@anmonteiro We do mention something already:

Do you mean to expand on that?

Right, I wonder if we should mention that these are no longer wrapped in array, or if it's OK just to document it in the changelog.

davesnx commented 3 months ago

I wonder if you can add the test case for a fragment (which is a list on the parsetree) which avoids the wrapping.

<Test> <div>{React.string("HI")}<div/> <div>{React.string("HI")}<div/> </Test>