Skip to content

Conversation

Josef-Thorne-A
Copy link

@Josef-Thorne-A Josef-Thorne-A commented Mar 11, 2025

This adds support for experimental object-method components as proposed here

These would look like this:

<obj#meth/>
or
<obj#meth>children</obj#meth>

The rationale for enabling this pattern is in the linked PR for MLX.

Probably should not be merged until the MLX PR is merged and the syntax is finalized.

Copy link
Owner

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

The PR make sense, but I would wait for mlx to merge the object syntax.

I will close the PR and reborn it when it happens, just for housecleaning purposes.

Thanks for the effort

Comment on lines +198 to +211
let obj =
object
method make () ~children = JSX.node "div" [] [ JSX.string children ]
end

(* The point of this test is to verify that --
* assuming our jsx provider has properly output the object component
* we can process it -- this avoids having to add any mlx files to our test
* or having to extend ReasonML *)
let object_children =
test "object_children" @@ fun () ->
let str = (obj#make () ~children:"test" [@JSX]) in
assert_string (JSX.render str) "<div>test</div>"

Copy link
Owner

Choose a reason for hiding this comment

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

This test doesn't reflect much from the change on the ppx. I mean, the current test case is valid without it.

@davesnx davesnx closed this Aug 5, 2025
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.

2 participants