File tree 2 files changed +13
-7
lines changed
2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 10
10
import type { ReactContext , ReactProviderType } from 'shared/ReactTypes' ;
11
11
import type { Fiber } from 'react-reconciler/src/ReactFiber' ;
12
12
import type { Hook } from 'react-reconciler/src/ReactFiberHooks' ;
13
+ import typeof { Dispatcher as DispatcherType } from 'react-reconciler/src/ReactFiberDispatcher' ;
13
14
14
15
import ErrorStackParser from 'error-stack-parser' ;
15
16
import ReactSharedInternals from 'shared/ReactSharedInternals' ;
@@ -209,7 +210,7 @@ function useMemo<T>(
209
210
return value ;
210
211
}
211
212
212
- const Dispatcher = {
213
+ const Dispatcher: DispatcherType = {
213
214
readContext ,
214
215
useCallback ,
215
216
useContext ,
Original file line number Diff line number Diff line change 7
7
* @flow
8
8
*/
9
9
10
+ import typeof { Dispatcher as DispatcherType } from 'react-reconciler/src/ReactFiberDispatcher' ;
10
11
import type { ThreadID } from './ReactThreadIDAllocator' ;
11
12
import type { ReactContext } from 'shared/ReactTypes' ;
12
13
import areHookInputsEqual from 'shared/areHookInputsEqual' ;
@@ -326,27 +327,31 @@ function dispatchAction<A>(
326
327
}
327
328
}
328
329
329
- function noop ( ) : void { }
330
- function identity(fn: Function): Function {
331
- return fn ;
330
+ export function useCallback < T > (
331
+ callback: T,
332
+ inputs: Array< mixed > | void | null,
333
+ ): T {
334
+ // Callbacks are passed as they are in the server environment.
335
+ return callback ;
332
336
}
333
337
338
+ function noop(): void { }
339
+
334
340
export let currentThreadID: ThreadID = 0;
335
341
336
342
export function setCurrentThreadID(threadID: ThreadID) {
337
343
currentThreadID = threadID ;
338
344
}
339
345
340
- export const Dispatcher = {
346
+ export const Dispatcher: DispatcherType = {
341
347
readContext ,
342
348
useContext ,
343
349
useMemo ,
344
350
useReducer ,
345
351
useRef ,
346
352
useState ,
347
353
useLayoutEffect ,
348
- // Callbacks are passed as they are in the server environment.
349
- useCallback : identity ,
354
+ useCallback ,
350
355
// useImperativeHandle is not run in the server environment
351
356
useImperativeHandle : noop ,
352
357
// Effects are not run in the server environment.
You can’t perform that action at this time.
0 commit comments