How to use template in useInnerBlocksProps? #121
-
Hi! I'm struggling with useInnerBlocksProps settings.
I'm currently trying to use useInnerBlocksProps instead and if I add my template in useInnerBlocksProps, but it doesn't work. Could you please advise me? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey 👋 The So in your example this would look something like this: const MY_TEMPLATE = [ ...Array(37) ].map( () => [ 'core/list', {} ] );
const innerBlocksProps = useInnerBlocksProps(
{
className: 'items',
},
{
template: MY_TEMPLATE,
templateLock: 'all'
}
);
<ul {...innerBlocksProps} /> hope this helps :) |
Beta Was this translation helpful? Give feedback.
Hey 👋
The
useInnerBlocksProps
hook accepts two objects as its arguments. The first object can contain any attributes you want to add to the wrapping element. The second object contains all of the settings for the inner block area.So in your example this would look something like this:
hope this helps :)