Repository navigation
Add jsx ppx for attribute @react.componentWithProps - #7203
Conversation
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.
| Benchmark suite | Current: 998282d | Previous: e1b7fb7 | Ratio |
|---|---|---|---|
Print RedBlackTree.res - time/run |
2.5336877066666665 ms |
2.3104395133333333 ms |
1.10 |
Print RedBlackTreeNoComments.res - time/run |
2.3414450266666664 ms |
2.10057036 ms |
1.11 |
Print Napkinscript.res - time/run |
81.58969135333332 ms |
77.00100409999999 ms |
1.06 |
Print HeroGraphic.res - time/run |
9.61578382 ms |
8.775952553333333 ms |
1.10 |
This comment was automatically generated by workflow using github-action-benchmark.
cknitt
left a comment
There was a problem hiding this comment.
Great work! Thanks a lot! Could you add a CHANGELOG entry?
Sure. |
|
Does it also work for bindings? Old syntax: @module("react-konva") @jsx.component(: props)
external make: props => Jsx.element = "Rect"JsxRuntime.jsx(ReactKonva.Rect, {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
fill: "black"
}, key);New syntax (doesn't work): @module("react-konva") @jsx.componentWithProps
external make: props => Jsx.element = "Rect"JsxRuntime.jsx(prim => ReactKonva.Rect(prim), {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
fill: "black"
}, key); |
Oh, I think we need to add the syntax error for BTW, the old one seems the proper binding for your case. |
|
So no chance to get it also working for external bindings? Asking just for consistency. |
@mununki is there any reason you didn't went with supporting |
…7203) * add ppx for attribute @react.componentWithProps * clean up the attribute after transformation * use fn_name * add arity=1 * build error using @react.componentWithProps with React.forwardRef * change log Signed-off-by: Pedro Castro <aspeddro@gmail.com>
This PR introduces a new
@react.componentWithPropsattribute that explicitly handles the props with shared props: