SelectControl and categories/tags


I’m trying to give users the ability to form a custom query via categories and tags, in a dynamic block. I’m assuming I can do this via multiple SelectControls (one for each taxonomy). This is what I have so far:

export default function Edit( { className, attributes, setAttributes } ) {

    const categories = useSelect(select =>
        select('core').getEntityRecords('taxonomy', 'category')

    return (
                <PanelBody title="Post selection" >
                            label={ __( 'Categories' ) }
                            help={ __( 'Select one or more categories' ) }
                            options={{id, name}) => ({label: name, value: id}))}

It’s predictably not working (getting minified react error #130). I’m a little sketchy on the use of HOCs and state management. If anyone can point me in the right direction, or suggest a better way, I’d appreciate it.

jshwlkr 2 years 2020-10-23T12:10:28-05:00 0 Answers 18 views 0

Leave an answer