Skip to content

Commit f41b21d

Browse files
committed
Update Reac tto 18
1 parent e413ce1 commit f41b21d

15 files changed

+424
-3824
lines changed

server/comments.re

+13-11
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,19 @@ module App = {
124124
style={ReactDOM.Style.make(~marginRight="16px", ())}>
125125
<Sidebar />
126126
</aside>
127-
<article className="post">
128-
<h1> {React.string("Hello world")} </h1>
129-
<Post />
130-
<section className="comments">
131-
<h3> {React.string("Comments")} </h3>
132-
<React.Suspense fallback={<Spinner />}>
133-
<Comments />
134-
</React.Suspense>
135-
</section>
136-
<h2> {React.string("Thanks for reading!")} </h2>
137-
</article>
127+
<React.Suspense fallback={<Spinner />}>
128+
<article className="post">
129+
<h1> {React.string("Hello world")} </h1>
130+
<Post />
131+
<section className="comments">
132+
<h3> {React.string("Comments")} </h3>
133+
<React.Suspense fallback={<Spinner />}>
134+
<Comments />
135+
</React.Suspense>
136+
</section>
137+
<h2> {React.string("Thanks for reading!")} </h2>
138+
</article>
139+
</React.Suspense>
138140
</main>
139141
</Layout>;
140142
};

vendor/reason-react/React.re

+81-46
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,23 @@ external createElementVariadic:
2828
(component('props), 'props, array(element)) => element =
2929
"createElement";
3030

31-
[@bs.module "react"] [@deprecated "Please use JSX syntax directly."]
32-
external jsxKeyed: (component('props), 'props, string) => element = "jsx";
31+
[@bs.module "react/jsx-runtime"]
32+
external jsxKeyed:
33+
(component('props), 'props, ~key: string=?, unit) => element =
34+
"jsx";
3335

34-
[@bs.module "react"] [@deprecated "Please use JSX syntax directly."]
36+
[@bs.module "react/jsx-runtime"]
3537
external jsx: (component('props), 'props) => element = "jsx";
3638

37-
[@bs.module "react"] [@deprecated "Please use JSX syntax directly."]
39+
[@bs.module "react/jsx-runtime"]
3840
external jsxs: (component('props), 'props) => element = "jsxs";
3941

40-
[@bs.module "react"] [@deprecated "Please use JSX syntax directly."]
41-
external jsxsKeyed: (component('props), 'props, string) => element = "jsxs";
42+
[@bs.module "react/jsx-runtime"]
43+
external jsxsKeyed:
44+
(component('props), 'props, ~key: string=?, unit) => element =
45+
"jsxs";
46+
47+
[@bs.module "react/jsx-runtime"] external jsxFragment: 'element = "Fragment";
4248

4349
type ref('value) = {mutable current: 'value};
4450

@@ -120,24 +126,23 @@ external memoCustomCompareProps:
120126

121127
module Fragment = {
122128
[@bs.obj]
123-
external makeProps:
124-
(~children: element, ~key: 'key=?, unit) => {. "children": element};
129+
external makeProps: (~children: element, unit) => {. "children": element};
130+
125131
[@bs.module "react"]
126132
external make: component({. "children": element}) = "Fragment";
127133
};
128134

129135
module StrictMode = {
130136
[@bs.obj]
131-
external makeProps:
132-
(~children: element, ~key: 'key=?, unit) => {. "children": element};
137+
external makeProps: (~children: element, unit) => {. "children": element};
133138
[@bs.module "react"]
134139
external make: component({. "children": element}) = "StrictMode";
135140
};
136141

137142
module Suspense = {
138143
[@bs.obj]
139144
external makeProps:
140-
(~children: element=?, ~fallback: element=?, ~key: 'key=?, unit) =>
145+
(~children: element=?, ~fallback: element=?, unit) =>
141146
{
142147
.
143148
"children": option(element),
@@ -153,35 +158,6 @@ module Suspense = {
153158
"Suspense";
154159
};
155160

156-
/* Experimental React.SuspenseList */
157-
module SuspenseList = {
158-
type revealOrder;
159-
type tail;
160-
[@bs.obj]
161-
external makeProps:
162-
(
163-
~children: element=?,
164-
~revealOrder: [ | `forwards | `backwards | `together]=?,
165-
~tail: [ | `collapsed | `hidden]=?,
166-
unit
167-
) =>
168-
{
169-
.
170-
"children": option(element),
171-
"revealOrder": option(revealOrder),
172-
"tail": option(tail),
173-
};
174-
175-
[@bs.module "react"]
176-
external make:
177-
component({
178-
.
179-
"children": option(element),
180-
"revealOrder": option(revealOrder),
181-
"tail": option(tail),
182-
}) =
183-
"SuspenseList";
184-
};
185161
/* HOOKS */
186162

187163
/*
@@ -211,6 +187,16 @@ external useReducerWithMapState:
211187
('state, 'action => unit) =
212188
"useReducer";
213189

190+
[@bs.module "react"]
191+
external useSyncExternalStore:
192+
(
193+
~subscribe: [@bs.uncurry] (unit => unit),
194+
~getSnapshot: [@bs.uncurry] (unit => 'snapshot),
195+
~getServerSnapshot: [@bs.uncurry] (unit => 'snapshot)=?
196+
) =>
197+
'snapshot =
198+
"useSyncExternalStore";
199+
214200
[@bs.module "react"]
215201
external useEffect: ([@bs.uncurry] (unit => option(unit => unit))) => unit =
216202
"useEffect";
@@ -254,6 +240,50 @@ external useEffect7:
254240
unit =
255241
"useEffect";
256242

243+
[@bs.module "react"]
244+
external useInsertionEffect:
245+
([@bs.uncurry] (unit => option(unit => unit))) => unit =
246+
"useInsertionEffect";
247+
[@bs.module "react"]
248+
external useInsertionEffect0:
249+
([@bs.uncurry] (unit => option(unit => unit)), [@bs.as {json|[]|json}] _) =>
250+
unit =
251+
"useInsertionEffect";
252+
[@bs.module "react"]
253+
external useInsertionEffect1:
254+
([@bs.uncurry] (unit => option(unit => unit)), array('a)) => unit =
255+
"useInsertionEffect";
256+
[@bs.module "react"]
257+
external useInsertionEffect2:
258+
([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b)) => unit =
259+
"useInsertionEffect";
260+
[@bs.module "react"]
261+
external useInsertionEffect3:
262+
([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c)) => unit =
263+
"useInsertionEffect";
264+
[@bs.module "react"]
265+
external useInsertionEffect4:
266+
([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd)) => unit =
267+
"useInsertionEffect";
268+
[@bs.module "react"]
269+
external useInsertionEffect5:
270+
([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e)) =>
271+
unit =
272+
"useInsertionEffect";
273+
[@bs.module "react"]
274+
external useInsertionEffect6:
275+
([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e, 'f)) =>
276+
unit =
277+
"useInsertionEffect";
278+
[@bs.module "react"]
279+
external useInsertionEffect7:
280+
(
281+
[@bs.uncurry] (unit => option(unit => unit)),
282+
('a, 'b, 'c, 'd, 'e, 'f, 'g)
283+
) =>
284+
unit =
285+
"useInsertionEffect";
286+
257287
[@bs.module "react"]
258288
external useLayoutEffect:
259289
([@bs.uncurry] (unit => option(unit => unit))) => unit =
@@ -329,7 +359,7 @@ external useMemo7:
329359
([@bs.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any =
330360
"useMemo";
331361

332-
/* This is used as return values */
362+
/* This is used as return values */
333363
type callback('input, 'output) = 'input => 'output;
334364

335365
[@bs.module "react"]
@@ -379,6 +409,9 @@ external useCallback7:
379409
external useContext: Context.t('any) => 'any = "useContext";
380410

381411
[@bs.module "react"] external useRef: 'value => ref('value) = "useRef";
412+
[@bs.module "react"] external useId: unit => string = "useId";
413+
414+
[@bs.module "react"] external useDeferredValue: 'a => 'a = "useDeferredValue";
382415

383416
[@bs.module "react"]
384417
external useImperativeHandle0:
@@ -523,16 +556,18 @@ module Uncurried = {
523556
"useCallback";
524557
};
525558

526-
type transitionConfig = {timeoutMs: int};
527-
528559
[@bs.module "react"]
529-
external useTransition:
530-
(~config: transitionConfig=?, unit) =>
531-
(callback(callback(unit, unit), unit), bool) =
560+
external useTransition: unit => (bool, callback(callback(unit, unit), unit)) =
532561
"useTransition";
533562

563+
[@bs.module "react"] external use: Js.Promise.t('a) => 'a = "use";
564+
534565
[@bs.set]
535566
external setDisplayName: (component('props), string) => unit = "displayName";
536567

537568
[@bs.get] [@bs.return nullable]
538569
external displayName: component('props) => option(string) = "displayName";
570+
571+
[@bs.module "react"]
572+
external useDebugValue: ('value, ~format: 'value => string=?, unit) => unit =
573+
"useDebugValue";

0 commit comments

Comments
 (0)