UNPKG

@wordpress/core-data

Version:
22 lines (20 loc) 520 B
/** * WordPress dependencies */ import { useContext } from '@wordpress/element'; /** * Internal dependencies */ import { EntityContext } from '../entity-context'; /** * Hook that returns the ID for the nearest * provided entity of the specified type. * * @param {string} kind The entity kind. * @param {string} name The entity name. */ export default function useEntityId(kind, name) { const context = useContext(EntityContext); return context?.[kind]?.[name]; } //# sourceMappingURL=use-entity-id.js.map