(Context: ReactContext<T>)
| 51 | } |
| 52 | |
| 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 | } |
| 65 | |
| 66 | export function useState<S>( |
| 67 | initialState: (() => S) | S, |