 10| import type {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
 11| import type {
 12|   ReactContext,
 13|   StartTransitionOptions,
 14|   Usable,
 15|   Awaited,
 16| } from 'shared/ReactTypes';
 17| import {REACT_CONSUMER_TYPE} from 'shared/ReactSymbols';
 19| import ReactSharedInternals from 'shared/ReactSharedInternals';
 21| type BasicStateAction<S> = (S => S) | S;
 22| type Dispatch<A> = A => void;
 24| function resolveDispatcher() {
 44| export function getCacheForType<T>(resourceType: () => T): T {
 45|   const dispatcher = ReactSharedInternals.A;
 46|   if (!dispatcher) {
 48|     return resourceType();
 49|   }
 50|   return dispatcher.getCacheForType(resourceType);
 51| }
 53| export function useContext<T>(Context: ReactContext<T>): T {
 54|   const dispatcher = resolveDispatcher();
 55|   if (__DEV__) {
 56|     if (Context.$$typeof === REACT_CONSUMER_TYPE) {
 57|       console.error(
 58|         'Calling useContext(Context.Consumer) is not supported and will cause bugs. ' +
 59|           'Did you mean to call useContext(Context) instead?',
 60|       );
 61|     }
 62|   }
 63|   return dispatcher.useContext(Context);
 64| }
 66| export function useState<S>(
 67|   initialState: (() => S) | S,
 68| ): [S, Dispatch<BasicStateAction<S>>] {
 69|   const dispatcher = resolveDispatcher();
 70|   return dispatcher.useState(initialState);
 71| }
 73| export function useReducer<S, I, A>(
 74|   reducer: (S, A) => S,
 75|   initialArg: I,
 76|   init?: I => S,
 77| ): [S, Dispatch<A>] {
 78|   const dispatcher = resolveDispatcher();
 79|   return dispatcher.useReducer(reducer, initialArg, init);
 80| }
 82| export function useRef<T>(initialValue: T): {current: T} {
 83|   const dispatcher = resolveDispatcher();
 84|

... [truncated 3165 chars] ...

esolveDispatcher();
215|   return dispatcher.useMemoCache(size);
216| }
218| export function useEffectEvent<Args, F: (...Array<Args>) => mixed>(
219|   callback: F,
220| ): F {
221|   const dispatcher = resolveDispatcher();
223|   return dispatcher.useEffectEvent(callback);
224| }
226| export function useOptimistic<S, A>(
227|   passthrough: S,
228|   reducer: ?(S, A) => S,
229| ): [S, (A) => void] {
230|   const dispatcher = resolveDispatcher();
231|   return dispatcher.useOptimistic(passthrough, reducer);
232| }
234| export function useActionState<S, P>(
235|   action: (Awaited<S>, P) => S,
236|   initialState: Awaited<S>,
237|   permalink?: string,
238| ): [Awaited<S>, (P) => void, boolean] {
239|   const dispatcher = resolveDispatcher();
240|   return dispatcher.useActionState(action, initialState, permalink);
241| }