Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

jchavarri
Copy link
Collaborator

@jchavarri jchavarri commented Nov 21, 2023

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>

Copy link
Member

@anmonteiro anmonteiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this make sense.

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

@jchavarri
Copy link
Collaborator Author

@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
Copy link
Member

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

Copy link
Member

@davesnx davesnx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great idea, uppercase components supporting any children looks nice

@davesnx
Copy link
Member

davesnx commented Jul 17, 2024

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>

@anmonteiro
Copy link
Member

merging this as discussed in https://ahrefs.slack.com/archives/C01RF16D2LA/p1732103117043289

let's revert if anyone disagrees.

@anmonteiro anmonteiro merged commit f95c8c6 into main Nov 24, 2024
3 checks passed
@anmonteiro anmonteiro deleted the fix-822 branch November 24, 2024 04:48
davesnx added a commit that referenced this pull request Nov 25, 2024
* 'main' of github.com:/reasonml/reason-react:
  Remove raise annotations and fix locations on errors (#863)
  ppx: support "custom children" in uppercase components without having to wrap in array literal (#823)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "custom children" in uppercase components
3 participants