@@ -1374,24 +1374,22 @@ let expr ~config mapper expression =
1374
1374
let transformChildrenToProps childrenExpr =
1375
1375
match childrenExpr with
1376
1376
| {pexp_desc = Pexp_array children } -> (
1377
- match children with
1378
- | [] -> emptyRecord ~loc: Location. none
1379
- | [child] -> recordOfChildren child
1380
- | _ -> (
1381
- match config.mode with
1382
- | "automatic" -> recordOfChildren @@ applyReactArray childrenExpr
1383
- | "classic" | _ -> emptyRecord ~loc: Location. none))
1384
- | _ -> (
1385
1377
match config.mode with
1386
- | "automatic" -> recordOfChildren @@ applyReactArray childrenExpr
1387
- | "classic" | _ -> emptyRecord ~loc: Location. none)
1378
+ | "automatic" -> (
1379
+ match children with
1380
+ | [] -> emptyRecord ~loc: Location. none
1381
+ | [child] -> recordOfChildren child
1382
+ | _ -> recordOfChildren @@ applyReactArray childrenExpr)
1383
+ | "classic" -> emptyRecord ~loc: Location. none
1384
+ | _ -> recordOfChildren @@ applyReactArray childrenExpr)
1385
+ | _ -> recordOfChildren @@ applyReactArray childrenExpr
1388
1386
in
1389
1387
let args =
1390
1388
(nolabel, fragment)
1391
1389
:: (nolabel, transformChildrenToProps childrenExpr)
1392
1390
::
1393
1391
(match config.mode with
1394
- | "classic" when countOfChildren childrenExpr > 1 ->
1392
+ | "classic" when countOfChildren childrenExpr > 0 ->
1395
1393
[(nolabel, childrenExpr)]
1396
1394
| _ -> [] )
1397
1395
in
@@ -1405,7 +1403,7 @@ let expr ~config mapper expression =
1405
1403
Exp. ident ~loc {loc; txt = Ldot (Lident " React" , " jsxs" )}
1406
1404
else Exp. ident ~loc {loc; txt = Ldot (Lident " React" , " jsx" )}
1407
1405
| "classic" | _ ->
1408
- if countOfChildren childrenExpr > 1 then
1406
+ if countOfChildren childrenExpr > 0 then
1409
1407
Exp. ident ~loc
1410
1408
{loc; txt = Ldot (Lident " React" , " createElementVariadic" )}
1411
1409
else
0 commit comments