@@ -14,11 +14,17 @@ type component<'props> = Jsx.component<'props>
14
14
15
15
let component = Jsx .component
16
16
17
+ /** Use Js_obj.assign, not Js.Obj.assign, otherwise the dependency will not be picked up correctly
18
+ in the ninja file. */
19
+ @inline
20
+ let addKeyProp = (p : 'props , k : string ): 'props =>
21
+ Obj .magic (Js .Obj .assign (Obj .magic (p ), {"key" : k }))
22
+
17
23
@module ("react" )
18
24
external createElement : (component <'props >, 'props ) => element = "createElement"
19
25
20
26
let createElementWithKey = (component , props , key ) =>
21
- createElement (component , Jsx . addKeyProp (props , key ))
27
+ createElement (component , addKeyProp (props , key ))
22
28
23
29
@module ("react" )
24
30
external cloneElement : (element , 'props ) => element = "cloneElement"
@@ -28,7 +34,7 @@ external createElementVariadic: (component<'props>, 'props, array<element>) => e
28
34
"createElement"
29
35
30
36
let createElementVariadicWithKey = (component , props , elements , key ) =>
31
- createElementVariadic (component , Jsx . addKeyProp (props , key ), elements )
37
+ createElementVariadic (component , addKeyProp (props , key ), elements )
32
38
33
39
@module ("react/jsx-runtime" )
34
40
external jsxKeyed : (component <'props >, 'props , string ) => element = "jsx"
0 commit comments