Gutenberg: useDispatch is not a function – @wordpress/data included

Question

I have the wordpress user/data package installed, but I can’t use useDispatch in my block edit function:

const { registerBlockType } = wp.blocks;
const { useDispatch, useSelect } = wp.data;
.
.
.
registerBlockType( 'rb-bootstrap/grid', {
    ...
    edit: function( props ) {
         const { replaceInnerBlocks } = useDispatch("core/block-editor");
    }
}

TypeError: useDispatch is not a function

What am I missing?

0
, , Raba 3 years 2019-10-22T23:38:02-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse