Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 555 Bytes

File metadata and controls

21 lines (16 loc) · 555 Bytes

useBlockParentAttributes

The useBlockParentAttributes hook is a simple utility that makes it easy interface with the attributes of the direct parent block.

Usage

import { useBlockParentAttributes } from '@10up/block-components';

function BlockEdit(props) {
    const [parentAttributes, setParentAttributes] = useBlockParentAttributes();

    return (
        <RichText
            tagName="h2"
            value={ parentAttributes.title }
            onChange={ value => setParentAttributes({ title: value }) }
         />
    );
}