react-redux
Version:
Official React bindings for Redux
24 lines (18 loc) • 549 B
JavaScript
import { createContext } from 'react';
let realContext = null;
function getContext() {
if (!realContext) {
realContext = createContext(null);
if (process.env.NODE_ENV !== 'production') {
realContext.displayName = 'ReactRedux';
}
}
return realContext;
}
export const ReactReduxContext = /*#__PURE__*/new Proxy({}, /*#__PURE__*/new Proxy({}, {
get(_, handler) {
const target = getContext(); // @ts-ignore
return (_target, ...args) => Reflect[handler](target, ...args);
}
}));
export default ReactReduxContext;