INNER CODE UNIT · TypeScript
getContext
reduxjs/react-redux · src/components/Context.ts:28
function getContext(): Context<ReactReduxContextValue | null> {
if (!React.createContext) return {} as any
const contextMap = (gT[ContextKey] ??= new Map<
typeof React.createContext,
Context<ReactReduxContextValue | null>
>())
let realContext = contextMap.get(React.createContext)
if (!realContext) {
realContext = React.createContext<ReactReduxContextValue | null>(
null as any,
)
if (process.env.NODE_ENV !== 'production') {
realContext.displayName = 'ReactRedux'
}
contextMap.set(React.createContext, realContext)
}
return realContext