I have the @wordpress/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?