-
Notifications
You must be signed in to change notification settings - Fork 349
/
React.re
884 lines (795 loc) · 27.1 KB
/
React.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
module Event = {
type synthetic('a);
module MakeEventWithType = (Type: {
type t;
}) => {
[@mel.get] external bubbles: Type.t => bool = "bubbles";
[@mel.get] external cancelable: Type.t => bool = "cancelable";
[@mel.get] external currentTarget: Type.t => Js.t({..}) = "currentTarget"; /* Should return Dom.eventTarget */
[@mel.get] external defaultPrevented: Type.t => bool = "defaultPrevented";
[@mel.get] external eventPhase: Type.t => int = "eventPhase";
[@mel.get] external isTrusted: Type.t => bool = "isTrusted";
[@mel.get] external nativeEvent: Type.t => Js.t({..}) = "nativeEvent"; /* Should return Dom.event */
[@mel.send] external preventDefault: Type.t => unit = "preventDefault";
[@mel.send]
external isDefaultPrevented: Type.t => bool = "isDefaultPrevented";
[@mel.send] external stopPropagation: Type.t => unit = "stopPropagation";
[@mel.send]
external isPropagationStopped: Type.t => bool = "isPropagationStopped";
[@mel.get] external target: Type.t => Js.t({..}) = "target"; /* Should return Dom.eventTarget */
[@mel.get] external timeStamp: Type.t => float = "timeStamp";
[@mel.get] external type_: Type.t => string = "type";
[@mel.send] external persist: Type.t => unit = "persist";
};
module Synthetic = {
type tag;
type t = synthetic(tag);
[@mel.get] external bubbles: synthetic('a) => bool = "bubbles";
[@mel.get] external cancelable: synthetic('a) => bool = "cancelable";
[@mel.get]
external currentTarget: synthetic('a) => Js.t({..}) = "currentTarget"; /* Should return Dom.eventTarget */
[@mel.get]
external defaultPrevented: synthetic('a) => bool = "defaultPrevented";
[@mel.get] external eventPhase: synthetic('a) => int = "eventPhase";
[@mel.get] external isTrusted: synthetic('a) => bool = "isTrusted";
[@mel.get]
external nativeEvent: synthetic('a) => Js.t({..}) = "nativeEvent"; /* Should return Dom.event */
[@mel.send]
external preventDefault: synthetic('a) => unit = "preventDefault";
[@mel.send]
external isDefaultPrevented: synthetic('a) => bool = "isDefaultPrevented";
[@mel.send]
external stopPropagation: synthetic('a) => unit = "stopPropagation";
[@mel.send]
external isPropagationStopped: synthetic('a) => bool =
"isPropagationStopped";
[@mel.get] external target: synthetic('a) => Js.t({..}) = "target"; /* Should return Dom.eventTarget */
[@mel.get] external timeStamp: synthetic('a) => float = "timeStamp";
[@mel.get] external type_: synthetic('a) => string = "type";
[@mel.send] external persist: synthetic('a) => unit = "persist";
};
/* Cast any event type to the general synthetic type. This is safe, since synthetic is more general */
external toSyntheticEvent: synthetic('a) => Synthetic.t = "%identity";
module Clipboard = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external clipboardData: t => Js.t({..}) = "clipboardData"; /* Should return Dom.dataTransfer */
};
module Composition = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external data: t => string = "data";
};
module Keyboard = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external altKey: t => bool = "altKey";
[@mel.get] external charCode: t => int = "charCode";
[@mel.get] external ctrlKey: t => bool = "ctrlKey";
[@mel.send]
external getModifierState: (t, string) => bool = "getModifierState";
[@mel.get] external key: t => string = "key";
[@mel.get] external keyCode: t => int = "keyCode";
[@mel.get] external locale: t => string = "locale";
[@mel.get] external location: t => int = "location";
[@mel.get] external metaKey: t => bool = "metaKey";
[@mel.get] external repeat: t => bool = "repeat";
[@mel.get] external shiftKey: t => bool = "shiftKey";
[@mel.get] external which: t => int = "which";
};
module Focus = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] [@mel.return nullable]
external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */
};
module Form = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
};
module Mouse = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external altKey: t => bool = "altKey";
[@mel.get] external button: t => int = "button";
[@mel.get] external buttons: t => int = "buttons";
[@mel.get] external clientX: t => int = "clientX";
[@mel.get] external clientY: t => int = "clientY";
[@mel.get] external ctrlKey: t => bool = "ctrlKey";
[@mel.send]
external getModifierState: (t, string) => bool = "getModifierState";
[@mel.get] external metaKey: t => bool = "metaKey";
[@mel.get] external movementX: t => int = "movementX";
[@mel.get] external movementY: t => int = "movementY";
[@mel.get] external pageX: t => int = "pageX";
[@mel.get] external pageY: t => int = "pageY";
[@mel.get] [@mel.return nullable]
external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */
[@mel.get] external screenX: t => int = "screenX";
[@mel.get] external screenY: t => int = "screenY";
[@mel.get] external shiftKey: t => bool = "shiftKey";
};
module Drag = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
// MouseEvent
[@mel.get] external altKey: t => bool = "altKey";
[@mel.get] external button: t => int = "button";
[@mel.get] external buttons: t => int = "buttons";
[@mel.get] external clientX: t => int = "clientX";
[@mel.get] external clientY: t => int = "clientY";
[@mel.get] external ctrlKey: t => bool = "ctrlKey";
[@mel.send]
external getModifierState: (t, string) => bool = "getModifierState";
[@mel.get] external metaKey: t => bool = "metaKey";
[@mel.get] external movementX: t => int = "movementX";
[@mel.get] external movementY: t => int = "movementY";
[@mel.get] external pageX: t => int = "pageX";
[@mel.get] external pageY: t => int = "pageY";
[@mel.get] [@mel.return nullable]
external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */
[@mel.get] external screenX: t => int = "screenX";
[@mel.get] external screenY: t => int = "screenY";
[@mel.get] external shiftKey: t => bool = "shiftKey";
[@mel.get] external dataTransfer: t => Js.t({..}) = "dataTransfer"; /* Should return Dom.dataTransfer */
};
module Pointer = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
// UIEvent
[@mel.get] external detail: t => int = "detail";
[@mel.get] external view: t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */
// MouseEvent
[@mel.get] external screenX: t => int = "screenX";
[@mel.get] external screenY: t => int = "screenY";
[@mel.get] external clientX: t => int = "clientX";
[@mel.get] external clientY: t => int = "clientY";
[@mel.get] external pageX: t => int = "pageX";
[@mel.get] external pageY: t => int = "pageY";
[@mel.get] external movementX: t => int = "movementX";
[@mel.get] external movementY: t => int = "movementY";
[@mel.get] external ctrlKey: t => bool = "ctrlKey";
[@mel.get] external shiftKey: t => bool = "shiftKey";
[@mel.get] external altKey: t => bool = "altKey";
[@mel.get] external metaKey: t => bool = "metaKey";
[@mel.send]
external getModifierState: (t, string) => bool = "getModifierState";
[@mel.get] external button: t => int = "button";
[@mel.get] external buttons: t => int = "buttons";
[@mel.get] [@mel.return nullable]
external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */
// PointerEvent
[@mel.get] external pointerId: t => Dom.eventPointerId = "pointerId";
[@mel.get] external width: t => float = "width";
[@mel.get] external height: t => float = "height";
[@mel.get] external pressure: t => float = "pressure";
[@mel.get] external tangentialPressure: t => float = "tangentialPressure";
[@mel.get] external tiltX: t => int = "tiltX";
[@mel.get] external tiltY: t => int = "tiltY";
[@mel.get] external twist: t => int = "twist";
[@mel.get] external pointerType: t => string = "pointerType";
[@mel.get] external isPrimary: t => bool = "isPrimary";
};
module Selection = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
};
module Touch = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external altKey: t => bool = "altKey";
[@mel.get] external changedTouches: t => Js.t({..}) = "changedTouches"; /* Should return Dom.touchList */
[@mel.get] external ctrlKey: t => bool = "ctrlKey";
[@mel.send]
external getModifierState: (t, string) => bool = "getModifierState";
[@mel.get] external metaKey: t => bool = "metaKey";
[@mel.get] external shiftKey: t => bool = "shiftKey";
[@mel.get] external targetTouches: t => Js.t({..}) = "targetTouches"; /* Should return Dom.touchList */
[@mel.get] external touches: t => Js.t({..}) = "touches"; /* Should return Dom.touchList */
};
module UI = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external detail: t => int = "detail";
[@mel.get] external view: t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */
};
module Wheel = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external deltaMode: t => int = "deltaMode";
[@mel.get] external deltaX: t => float = "deltaX";
[@mel.get] external deltaY: t => float = "deltaY";
[@mel.get] external deltaZ: t => float = "deltaZ";
};
module Media = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
};
module Image = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
};
module Animation = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external animationName: t => string = "animationName";
[@mel.get] external pseudoElement: t => string = "pseudoElement";
[@mel.get] external elapsedTime: t => float = "elapsedTime";
};
module Transition = {
type tag;
type t = synthetic(tag);
include MakeEventWithType({
type nonrec t = t;
});
[@mel.get] external propertyName: t => string = "propertyName";
[@mel.get] external pseudoElement: t => string = "pseudoElement";
[@mel.get] external elapsedTime: t => float = "elapsedTime";
};
};
type element;
type componentLike('props, 'return) = 'props => 'return;
type component('props) = componentLike('props, element);
external null: element = "null";
external float: float => element = "%identity";
external int: int => element = "%identity";
external string: string => element = "%identity";
external array: array(element) => element = "%identity";
/* this function exists to prepare for making `component` abstract */
external component: componentLike('props, element) => component('props) =
"%identity";
[@mel.module "react"]
external createElement: (component('props), 'props) => element =
"createElement";
[@mel.module "react"]
external cloneElement: (element, 'props) => element = "cloneElement";
[@mel.variadic] [@mel.module "react"]
external createElementVariadic:
(component('props), 'props, array(element)) => element =
"createElement";
[@mel.module "react/jsx-runtime"]
external jsxKeyed:
(component('props), 'props, ~key: string=?, unit) => element =
"jsx";
[@mel.module "react/jsx-runtime"]
external jsx: (component('props), 'props) => element = "jsx";
[@mel.module "react/jsx-runtime"]
external jsxs: (component('props), 'props) => element = "jsxs";
[@mel.module "react/jsx-runtime"]
external jsxsKeyed:
(component('props), 'props, ~key: string=?, unit) => element =
"jsxs";
[@mel.module "react/jsx-runtime"] external jsxFragment: 'element = "Fragment";
type ref('value) = {mutable current: 'value};
module Ref = {
[@deprecated "Please use the type React.ref instead"]
type t('value) = ref('value);
[@deprecated "Please directly read from ref.current instead"] [@mel.get]
external current: ref('value) => 'value = "current";
[@deprecated "Please directly assign to ref.current instead"] [@mel.set]
external setCurrent: (ref('value), 'value) => unit = "current";
};
[@mel.module "react"]
external createRef: unit => ref(Js.nullable('a)) = "createRef";
module Children = {
[@mel.module "react"] [@mel.scope "Children"]
external map: (element, element => element) => element = "map";
[@mel.module "react"] [@mel.scope "Children"]
external mapWithIndex:
(element, [@mel.uncurry] ((element, int) => element)) => element =
"map";
[@mel.module "react"] [@mel.scope "Children"]
external forEach: (element, element => unit) => unit = "forEach";
[@mel.module "react"] [@mel.scope "Children"]
external forEachWithIndex:
(element, [@mel.uncurry] ((element, int) => unit)) => unit =
"forEach";
[@mel.module "react"] [@mel.scope "Children"]
external count: element => int = "count";
[@mel.module "react"] [@mel.scope "Children"]
external only: element => element = "only";
[@mel.module "react"] [@mel.scope "Children"]
external toArray: element => array(element) = "toArray";
};
module Context = {
type t('props);
[@mel.obj]
external makeProps:
(~value: 'props, ~children: element, unit) =>
{
.
"value": 'props,
"children": element,
};
[@mel.get]
external provider:
t('props) =>
component({
.
"value": 'props,
"children": element,
}) =
"Provider";
};
[@mel.module "react"]
external createContext: 'a => Context.t('a) = "createContext";
[@mel.module "react"]
external forwardRef:
([@mel.uncurry] (('props, Js.Nullable.t(ref('a))) => element)) =>
component('props) =
"forwardRef";
[@mel.module "react"]
external memo: component('props) => component('props) = "memo";
[@mel.module "react"]
external memoCustomCompareProps:
(component('props), [@mel.uncurry] (('props, 'props) => bool)) =>
component('props) =
"memo";
module Fragment = {
[@mel.obj]
external makeProps: (~children: element, unit) => {. "children": element};
[@mel.module "react"]
external make: component({. "children": element}) = "Fragment";
};
module StrictMode = {
[@mel.obj]
external makeProps: (~children: element, unit) => {. "children": element};
[@mel.module "react"]
external make: component({. "children": element}) = "StrictMode";
};
module Suspense = {
[@mel.obj]
external makeProps:
(~children: element=?, ~fallback: element=?, unit) =>
{
.
"children": option(element),
"fallback": option(element),
};
[@mel.module "react"]
external make:
component({
.
"children": option(element),
"fallback": option(element),
}) =
"Suspense";
};
[@mel.set]
external setDisplayName: (component('props), string) => unit = "displayName";
[@mel.get] [@mel.return nullable]
external displayName: component('props) => option(string) = "displayName";
/* HOOKS */
/* This is used as return values */
type callback('input, 'output) = 'input => 'output;
/*
* Yeah, we know this api isn't great. tl;dr: useReducer instead.
* It's because useState can take functions or non-function values and treats
* them differently. Lazy initializer + callback which returns state is the
* only way to safely have any type of state and be able to update it correctly.
*/
[@mel.module "react"]
external useState:
([@mel.uncurry] (unit => 'state)) => ('state, ('state => 'state) => unit) =
"useState";
[@mel.module "react"]
external useReducer:
([@mel.uncurry] (('state, 'action) => 'state), 'state) =>
('state, 'action => unit) =
"useReducer";
[@mel.module "react"]
external useReducerWithMapState:
(
[@mel.uncurry] (('state, 'action) => 'state),
'initialState,
[@mel.uncurry] ('initialState => 'state)
) =>
('state, callback('action, unit)) =
"useReducer";
[@mel.module "react"]
external useSyncExternalStore:
(
~subscribe: (unit => unit) => callback(unit, unit),
~getSnapshot: unit => 'snapshot
) =>
'snapshot =
"useSyncExternalStore";
[@mel.module "react"]
external useSyncExternalStoreWithServer:
(
~subscribe: (unit => unit) => callback(unit, unit),
~getSnapshot: unit => 'snapshot,
~getServerSnapshot: [@mel.uncurry] (unit => 'snapshot)
) =>
'snapshot =
"useSyncExternalStore";
[@mel.module "react"]
external useEffect: ([@mel.uncurry] (unit => option(unit => unit))) => unit =
"useEffect";
[@mel.module "react"]
external useEffect0:
(
[@mel.uncurry] (unit => option(unit => unit)),
[@mel.as {json|[]|json}] _
) =>
unit =
"useEffect";
[@mel.module "react"]
external useEffect1:
([@mel.uncurry] (unit => option(unit => unit)), array('a)) => unit =
"useEffect";
[@mel.module "react"]
external useEffect2:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b)) => unit =
"useEffect";
[@mel.module "react"]
external useEffect3:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c)) => unit =
"useEffect";
[@mel.module "react"]
external useEffect4:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd)) => unit =
"useEffect";
[@mel.module "react"]
external useEffect5:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e)) =>
unit =
"useEffect";
[@mel.module "react"]
external useEffect6:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f)
) =>
unit =
"useEffect";
[@mel.module "react"]
external useEffect7:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f, 'g)
) =>
unit =
"useEffect";
[@mel.module "react"]
external useInsertionEffect:
([@mel.uncurry] (unit => option(unit => unit))) => unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect0:
(
[@mel.uncurry] (unit => option(unit => unit)),
[@mel.as {json|[]|json}] _
) =>
unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect1:
([@mel.uncurry] (unit => option(unit => unit)), array('a)) => unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect2:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b)) => unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect3:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c)) => unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect4:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd)) => unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect5:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e)) =>
unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect6:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f)
) =>
unit =
"useInsertionEffect";
[@mel.module "react"]
external useInsertionEffect7:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f, 'g)
) =>
unit =
"useInsertionEffect";
[@mel.module "react"]
external useLayoutEffect:
([@mel.uncurry] (unit => option(unit => unit))) => unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect0:
(
[@mel.uncurry] (unit => option(unit => unit)),
[@mel.as {json|[]|json}] _
) =>
unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect1:
([@mel.uncurry] (unit => option(unit => unit)), array('a)) => unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect2:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b)) => unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect3:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c)) => unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect4:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd)) => unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect5:
([@mel.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e)) =>
unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect6:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f)
) =>
unit =
"useLayoutEffect";
[@mel.module "react"]
external useLayoutEffect7:
(
[@mel.uncurry] (unit => option(unit => unit)),
('a, 'b, 'c, 'd, 'e, 'f, 'g)
) =>
unit =
"useLayoutEffect";
[@mel.module "react"]
external useMemo: ([@mel.uncurry] (unit => 'any)) => 'any = "useMemo";
[@mel.module "react"]
external useMemo0:
([@mel.uncurry] (unit => 'any), [@mel.as {json|[]|json}] _) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo1: ([@mel.uncurry] (unit => 'any), array('a)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo2: ([@mel.uncurry] (unit => 'any), ('a, 'b)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo3: ([@mel.uncurry] (unit => 'any), ('a, 'b, 'c)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo4: ([@mel.uncurry] (unit => 'any), ('a, 'b, 'c, 'd)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo5:
([@mel.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo6:
([@mel.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f)) => 'any =
"useMemo";
[@mel.module "react"]
external useMemo7:
([@mel.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any =
"useMemo";
[@mel.module "react"] external useCallback: 'fn => 'fn = "useCallback";
[@mel.module "react"]
external useCallback0: ('fn, [@mel.as {json|[]|json}] _) => 'fn =
"useCallback";
[@mel.module "react"]
external useCallback1: ('fn, array('a)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback2: ('fn, ('a, 'b)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback3: ('fn, ('a, 'b, 'c)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback4: ('fn, ('a, 'b, 'c, 'd)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback5: ('fn, ('a, 'b, 'c, 'd, 'e)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback6: ('fn, ('a, 'b, 'c, 'd, 'e, 'f)) => 'fn = "useCallback";
[@mel.module "react"]
external useCallback7: ('fn, ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'fn =
"useCallback";
[@mel.module "react"]
external useContext: Context.t('any) => 'any = "useContext";
[@mel.module "react"] external useRef: 'value => ref('value) = "useRef";
[@mel.module "react"] external useId: unit => string = "useId";
[@mel.module "react"] external useDeferredValue: 'a => 'a = "useDeferredValue";
[@mel.module "react"]
external useImperativeHandle0:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
[@mel.as {json|[]|json}] _
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle1:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
array('a)
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle2:
(Js.Nullable.t(ref('value)), [@mel.uncurry] (unit => 'value), ('a, 'b)) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle3:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
('a, 'b, 'c)
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle4:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
('a, 'b, 'c, 'd)
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle5:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
('a, 'b, 'c, 'd, 'e)
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle6:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
('a, 'b, 'c, 'd, 'e, 'f)
) =>
unit =
"useImperativeHandle";
[@mel.module "react"]
external useImperativeHandle7:
(
Js.Nullable.t(ref('value)),
[@mel.uncurry] (unit => 'value),
('a, 'b, 'c, 'd, 'e, 'f, 'g)
) =>
unit =
"useImperativeHandle";
module Uncurried = {
[@mel.module "react"]
external useState:
([@mel.uncurry] (unit => 'state)) =>
('state, (. ('state => 'state)) => unit) =
"useState";
[@mel.module "react"]
external useReducer:
([@mel.uncurry] (('state, 'action) => 'state), 'state) =>
('state, (. 'action) => unit) =
"useReducer";
[@mel.module "react"]
external useReducerWithMapState:
(
[@mel.uncurry] (('state, 'action) => 'state),
'initialState,
[@mel.uncurry] ('initialState => 'state)
) =>
('state, (. 'action) => unit) =
"useReducer";
/* This is used as return values */
type callback('input, 'output) = (. 'input) => 'output;
[@mel.module "react"]
external useCallback:
([@mel.uncurry] ('input => 'output)) => callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback0:
([@mel.uncurry] ('input => 'output), [@mel.as {json|[]|json}] _) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback1:
([@mel.uncurry] ('input => 'output), array('a)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback2:
([@mel.uncurry] ('input => 'output), ('a, 'b)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback3:
([@mel.uncurry] ('input => 'output), ('a, 'b, 'c)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback4:
([@mel.uncurry] ('input => 'output), ('a, 'b, 'c, 'd)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback5:
([@mel.uncurry] ('input => 'output), ('a, 'b, 'c, 'd, 'e)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback6:
([@mel.uncurry] ('input => 'output), ('a, 'b, 'c, 'd, 'e, 'f)) =>
callback('input, 'output) =
"useCallback";
[@mel.module "react"]
external useCallback7:
([@mel.uncurry] ('input => 'output), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) =>
callback('input, 'output) =
"useCallback";
};
[@mel.module "react"]
external useTransition: unit => (bool, callback(callback(unit, unit), unit)) =
"useTransition";
[@mel.module "react"]
external useDebugValue: ('value, ~format: 'value => string=?, unit) => unit =
"useDebugValue";
module Experimental = {
/* This module is used to bind to APIs for future versions of React. There is no guarantee of backwards compatibility or stability. */
[@mel.module "react"] external use: Js.Promise.t('a) => 'a = "use";
};