[ad_1]
Hello everyone
I’m trying to use the InnerBlocks ButtonBlockAppender inside a custom block, where I use Block- and InnerBlocksProps. But it doesn’t work…
My question: Is this even possible or is there another way?
I know I just could use the InnerBlock Component instead of BlockProps but that wouldn’t be as “satisfying”
I’ve tried like this:
const {useBlockProps, useInnerBlocksProps, InnerBlocks} = wp.blockEditor;
export default ({setAttributes, clientId}) => {
setAttributes({accordionId: clientId});
const blockProps = useBlockProps();
const innerBlockProps = useInnerBlocksProps(
{
className: 'accordion',
},
{
allowedBlocks: ['test/accordion-item'],
},
{
template: [['test/accordion-item', {}]],
},
{
renderAppender: InnerBlocks.ButtonBlockAppender,
},
);
return (
<>
</>
);
};
