25 lines
927 B
Plaintext
25 lines
927 B
Plaintext
/**
|
|
* External dependencies
|
|
*/
|
|
import type { BlockAttributes } from '@wordpress/blocks';
|
|
import { useWooBlockProps } from '@woocommerce/block-templates';
|
|
import { createElement } from '@wordpress/element';
|
|
|
|
/**
|
|
* The edit function describes the structure of your block in the context of the
|
|
* editor. This represents what the editor will render when the block is used.
|
|
*
|
|
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
|
|
*
|
|
*/
|
|
export function Edit( { attributes }: { attributes: BlockAttributes } ) {
|
|
/**
|
|
* React hook that is used to mark the block wrapper element.
|
|
* It provides all the necessary props like the class name.
|
|
*
|
|
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
|
|
*/
|
|
const blockProps = useWooBlockProps(attributes);
|
|
return <div { ...blockProps }>{ attributes.message }</div>;
|
|
}
|