@@ -40,7 +40,7 @@ It produces a type definition and a new function.
40
40
41
41
// is converted to
42
42
43
- type props<'x, 'y, 'z> = {x: 'x, @optional y : 'y, @optional z : 'z, @optional key: string }
43
+ type props<'x, 'y, 'z> = {x: 'x, y? : 'y, z? : 'z}
44
44
45
45
({x, y, z}: props<_>) => {
46
46
let y = switch props.y {
@@ -60,11 +60,11 @@ React.createElement(Comp.make, {x})
60
60
61
61
<Comp x y=7 ?z>
62
62
// is converted to
63
- React.createElement(Comp.make, {x, y:7, @optional z})
63
+ React.createElement(Comp.make, {x, y:7, ? z})
64
64
65
65
<Comp x key="7">
66
66
// is converted to
67
- React.createElement(Comp.make, {x, key: "7"} )
67
+ React.createElement(Comp.make, Jsx.addKeyProp({x}, "7") )
68
68
```
69
69
70
70
** New "jsx" transform**
@@ -76,16 +76,16 @@ The "jsx" transform affects component application but not the definition.
76
76
``` rescript
77
77
<Comp x>
78
78
// is converted to
79
- Js. React.jsx(Comp.make, {x})
79
+ React.jsx(Comp.make, {x})
80
80
```
81
81
82
82
``` rescript
83
83
<div name="div" />
84
84
// is converted to
85
- Js.React.jsxDom ("div", { name: "div" })
85
+ ReactDOM.jsx ("div", { name: "div" })
86
86
```
87
87
88
- The props type of dom elements, e.g. ` div ` , is inferred to ` Js.React .domProps` .
88
+ The props type of dom elements, e.g. ` div ` , is inferred to ` ReactDOM .domProps` .
89
89
90
90
``` rescript
91
91
type domProps = {
@@ -102,7 +102,7 @@ type domProps = {
102
102
103
103
// is converted to
104
104
105
- type props<'x, 'y, 'z> = {x: 'x, @optional y : 'y, @optional z : 'z}
105
+ type props<'x, 'y, 'z> = {x: 'x, y? : 'y, z? : 'z}
106
106
107
107
props<int, int, int> => React.element
108
108
```
@@ -121,7 +121,11 @@ function has the name of the enclosing module/file.
121
121
122
122
// is converted to
123
123
124
+ // v4
124
125
ReactDOMRe.createElement(ReasonReact.fragment, [comp1, comp2, comp3])
126
+
127
+ // v4 @ new jsx transform
128
+ React.jsxs(React.jsxFragment, {children: [comp1, comp2, comp3]})
125
129
```
126
130
127
131
** File-level config**
0 commit comments