Using RenderApender with innerBlocksProps | WordPress.org

[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 (
		<>
			
		</>
	);
};

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer