The usePrimaryTerm
hook retrieves the primary term of any given taxonomy.
Warning This hook will not function without having Yoast SEO installed and activated.
import { usePrimaryTerm } from '@10up/block-components';
function BlockEdit(props) {
const [primaryCategory, isSupportingCategory] = usePrimaryTerm('category');
return (
...
);
}