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

Commit 307b35c

Browse files
mununkicristianoc
authored andcommitted
use variable, fix error msg
1 parent 86f1e93 commit 307b35c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cli/reactjs_jsx_v4.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ let makeModuleName fileName nestedModules fnName =
175175

176176
(* make record from props and spread props if exists *)
177177
let recordFromProps ~loc ~removeKey callArguments =
178+
let spreadPropsLabel = "_spreadProps" in
178179
let rec removeLastPositionUnitAux props acc =
179180
match props with
180181
| [] -> acc
@@ -185,13 +186,13 @@ let recordFromProps ~loc ~removeKey callArguments =
185186
"JSX: found non-labelled argument before the last position"
186187
| ((Labelled txt, {pexp_loc}) as prop) :: rest
187188
| ((Optional txt, {pexp_loc}) as prop) :: rest ->
188-
if txt = "_spreadProps" then
189+
if txt = spreadPropsLabel then
189190
match acc with
190191
| [] -> removeLastPositionUnitAux rest (prop :: acc)
191192
| _ ->
192193
React_jsx_common.raiseError ~loc:pexp_loc
193-
"JSX: spread props should be first in order than other props\n\
194-
\ and multiple spread props are not allowed."
194+
"JSX: use {...p} {x: v} not {x: v} {...p} \n\
195+
\ multiple spreads {...p} {...p} not allowed."
195196
else removeLastPositionUnitAux rest (prop :: acc)
196197
in
197198
let props, propsToSpread =

0 commit comments

Comments
 (0)