@wordpress/components
Version:
UI components for WordPress.
27 lines (23 loc) • 653 B
JavaScript
// @ts-nocheck
/**
* External dependencies
*/
import { useSnapshot } from 'valtio';
/**
* WordPress dependencies
*/
import { useContext } from '@wordpress/element';
/**
* Internal dependencies
*/
import SlotFillContext from './slot-fill-context';
export default function useSlotFills(name) {
const registry = useContext(SlotFillContext);
const fills = 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