|
38 | 38 | `ReactDOMRe.createDOMElementVariadic("div", ~props=ReactDOMRe.domProps(~props1=1, ~props2=b), [|foo, bar|])`.
|
39 | 39 | transform the upper-cased case
|
40 | 40 | `[@JSX] Foo.createElement(~key=a, ~ref=b, ~foo=bar, ~spreadProps=baz ~children=[], ())` into
|
41 |
| - `Foo.make({...baz, key: a, ref: b, foo: bar})` |
| 41 | + `React.createElement(Foo.make, {...baz, key: a, ref: b, foo: bar})` |
42 | 42 | transform the upper-cased case
|
43 | 43 | `[@JSX] Foo.createElement(~foo=bar, ~spreadProps=baz, ~children=[foo, bar], ())` into
|
44 |
| - Foo.make({...baz, foo: bar, children: React.null}), [|foo, bar|])` |
| 44 | + `React.createElement(Foo.make, {...baz, foo: bar, children: React.null}), [|foo, bar|])` |
45 | 45 | transform `[@JSX] [foo]` into
|
46 | 46 | `ReactDOMRe.createElement(ReasonReact.fragment, [|foo|])`
|
47 | 47 | *)
|
48 | 48 |
|
| 49 | +(* |
| 50 | + New JSX transform with React v17 |
| 51 | +
|
| 52 | + if has key |
| 53 | + `jsxKeyed("div", { ... }, "key") or jsxsKeyed("div", { ... }, "key")` |
| 54 | +
|
| 55 | + upper case |
| 56 | + child X -> `jsx(Foo.make, { ... })` |
| 57 | + child -> `jsx(Foo.make, { ... , children: ... })` |
| 58 | + children O -> `jsxs(Foo.make, { ..., children: [ ... ]})` |
| 59 | +
|
| 60 | + lower case |
| 61 | + child X -> `jsx("div", { ... })` |
| 62 | + child O -> `jsx("div", { ..., children: ... })` |
| 63 | + children O -> `jsxs("div", { ..., children: [ ... ]})` |
| 64 | +*) |
49 | 65 | val rewrite_implementation : Parsetree.structure -> Parsetree.structure
|
50 | 66 |
|
51 | 67 | val rewrite_signature : Parsetree.signature -> Parsetree.signature
|
0 commit comments