I have created a gutenberg Slider-Block and a child block called slide. I want to update the slider everytime when a slide gets updated. I use the componentDidUpdate() from the innerBlock (the slide) but I don't know how to access the parent from there.
1 Answers
0
votes
You can access the parent block by using the following code:
// Get child block ID
const parentClientId = select( 'core/block-editor' ).getBlockHierarchyRootClientId( props.clientId );
// Get parent attributes using child block ID
// @see https://github.com/WordPress/gutenberg/issues/9032
const { iconStyle, iconSize, iconColor } = select( 'core/block-editor' ).getBlockAttributes( parentClientId );