@wordpress/components
Version:
UI components for WordPress.
39 lines (29 loc) • 897 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useSlotFills;
var _valtio = require("valtio");
var _element = require("@wordpress/element");
var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
// @ts-nocheck
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSlotFills(name) {
const registry = (0, _element.useContext)(_slotFillContext.default);
const fills = (0, _valtio.useSnapshot)(registry.fills, {
sync: true
}); // The important bit here is that this call ensures that the hook
// only causes a re-render if the "fills" of a given slot name
// change change, not any fills.
return fills.get(name);
}
//# sourceMappingURL=use-slot-fills.js.map