Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 75f8a28

Browse files
committed
update ppx v4 spec with new jsx transform
1 parent 7f6e7c4 commit 75f8a28

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cli/JSXV4.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,34 @@ React.createElement(Comp.make, {x, y:7, @optional z})
7070
React.createElement(Comp.make, {x, key: "7"})
7171
```
7272

73+
**The new JSX transform**
74+
75+
The JSX PPX V4 supports [the new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) of React.js.
76+
77+
It affects only the application.
78+
79+
```rescript
80+
<Comp x>
81+
// is converted to
82+
Js.React.jsx(Comp.make, {x})
83+
```
84+
85+
```rescript
86+
<div name="div" />
87+
// is converted to
88+
Js.React.jsxDom("div", { name: "div" })
89+
```
90+
91+
The props type of dom elements, e.g. `div`, is inferred to `Js.React.domProps`.
92+
93+
```rescript
94+
type domProps = {
95+
key?: string,
96+
id?: string,
97+
...
98+
}
99+
```
100+
73101
**Interface And External**
74102

75103
```rescript

0 commit comments

Comments
 (0)