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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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>

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