Repository navigation
How to use template in useInnerBlocksProps? #121
Answered
by
fabiankaegy
miho-birds
asked this question in
Q&A
|
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. |
Answered by
fabiankaegy
Feb 21, 2023
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 :) |
1 reply
Answer selected by
fabiankaegy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey 👋
The
useInnerBlocksPropshook 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 :)