This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Builderオブジェクトの型 | |
type Builder<Props, Result> = ({} extends Props | |
? { | |
build: () => Result; | |
} | |
: {}) & | |
{ [P in keyof Props]-?: SetFunction<Props, P, Result> }; | |
type SetFunction<Props, K extends keyof Props, Result> = ( | |
value: Exclude<Props[K], undefined> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Fragment, useCallback } from '@wordpress/element'; | |
import { useDispatch, useSelect } from '@wordpress/data'; | |
const useMeta = ( key ) => { | |
const meta = useSelect( ( select ) => { | |
const { getEditedPostAttribute } = select( 'core/editor' ); | |
const values = getEditedPostAttribute( 'meta' ) || {}; | |
return values[ key ] || ''; | |
}, [] ); |
OlderNewer