UNPKG

@visactor/react-vtable

Version:

The react version of VTable

25 lines (20 loc) 862 B
"use strict"; var __importDefault = this && this.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.withTableInstance = void 0; const react_1 = __importDefault(require("react")), TableContext = react_1.default.createContext(null); function withTableInstance(Component) { const Com = react_1.default.forwardRef(((props, ref) => react_1.default.createElement(TableContext.Consumer, null, (ctx => react_1.default.createElement(Component, Object.assign({ ref: ref, table: ctx.table }, props)))))); return Com.displayName = Component.name, Com; } TableContext.displayName = "TableContext", exports.withTableInstance = withTableInstance, exports.default = TableContext; //# sourceMappingURL=table.js.map