reason-react icon indicating copy to clipboard operation
reason-react copied to clipboard

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

Open jchavarri opened this issue 1 year ago • 3 comments

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 avatar Nov 21 '23 21:11 jchavarri

@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:

  • https://reasonml.github.io/docs/en/jsx#capitalized-tag
  • https://reasonml.github.io/docs/en/jsx#uncapitalized-tag

Do you mean to expand on that?

jchavarri avatar Dec 08 '23 08:12 jchavarri

@anmonteiro We do mention something already:

  • https://reasonml.github.io/docs/en/jsx#capitalized-tag
  • https://reasonml.github.io/docs/en/jsx#uncapitalized-tag

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.

anmonteiro avatar Dec 11 '23 14:12 anmonteiro

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>

davesnx avatar Jul 17 '24 07:07 davesnx