I am utilizing @wordpress/create-block
to create a customized Gutenberg block.
When including the block in Gutenberg, I obtain the error:
Error: Minified React error #130; go to https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the complete message or use the non-minified dev surroundings for full errors and extra useful warnings.
Aspect sort is invalid: anticipated a string (for built-in parts) or a category/perform (for composite parts) however obtained: undefined.
edit.js
:
/**
* React hook that's used to mark the block wrapper ingredient.
* It gives all the mandatory props like the category title.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
*/
import { TextControl, NumberControl, MediaPlaceholder } from '@wordpress/parts';
/**
* The save perform defines the way in which through which the completely different attributes ought to
* be mixed into the ultimate markup, which is then serialized by the block
* editor into `post_content`.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save
*
* @param {Object} props Properties handed to the perform.
* @param {Object} props.attributes Obtainable block attributes.
* @return {WPElement} Aspect to render.
*/
export default perform Edit( { attributes, setAttributes } ) {
return (
<div className="part section-hero">
<div className="row">
<div className="col-45">
<h1 className="fl-heading padding-20-20 mobile-centered" id="hero-title">
<span className="fl-heading-text">
<TextControl
label="Heading"
worth={ attributes.hero_heading }
onChange={(val) => {
setAttributes({ hero_heading: val });
}}
/>
</span>
</h1>
<p className="padding-20-20 mobile-centered">
<TextControl
label="Description"
worth={ attributes.hero_description }
onChange={(val) => {
setAttributes({ hero_description: val });
}}
/>
</p>
<p id='hero-buttons' className="padding-20-20 mobile-centered" type={{marginBottom: 0}}>
<a href="https://sandbox.mandoemedia.com/signup?origin=mktg_portal" className="pp-button-1" position="button" goal="_self">
<TextControl
label="Button 1 CTA"
worth={attributes.button_1_cta}
onChange={(val) => {
setAttributes({ button_1_cta: val });
}}
/>
</a>
<a href="https://sandbox.mandoemedia.com/sandbox-wizard" className="pp-button-2" position="button" goal="_self" onclick=''>
<span className="pp-button-2-text">
<TextControl
label="Button 2 CTA"
worth={attributes.button_2_cta}
onChange={(val) => {
setAttributes({ button_2_cta: val });
}}
/>
</span>
</a>
</p>
<div className="pp-rating-content padding-20-20">
<div className="pp-rating mobile-centered">
<i className="pp-star-full">★</i><i className="pp-star-full">★</i><i className="pp-star-full">★</i><i className="pp-star-full">★</i><i className="pp-star-full">★</i>
</div>
<div className="pp-rating-title mobile-centered">
<NumberControl
label="Variety of 5 Star Evaluations"
isShiftStepEnabled={false}
worth={ attributes.number_of_5_star_reviews }
onChange={(val) => {
setAttributes({ number_of_5_star_reviews: Quantity(val) });
}}
/>
+ 5-star critiques on Google</div>
</div>
</div>
<div className="col-55">
<div id="videoLaunch">
if(attributes.hero_image_URL) {
(
<img
src={ attributes.hero_image_URL }
// onClick={ openEvent }
id="mm-hero"
/>
)
}
else {
(
<MediaPlaceholder
onSelect = { media => { setAttributes({ hero_image_alt: media.alt, hero_image_URL: media.url }); } }
allowedTypes = { [ 'image' ] }
a number of = { false }
labels = { { title: 'Add' } }
>
</MediaPlaceholder>
)
}
<div className="mm-video-popup-icon"><i className="fas fa-play"></i></div>
</div>
<div id="vidBoxContainer">
<button sort="button" id="vidClose" title="Shut">
<svg xmlns="http://www.w3.org/2000/svg" model="1.1" viewBox="0 0 24 24">
<path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"></path>
</svg>
</button>
<div id="vidBox">
<video id="mm-video" url={attributes.hero_video} controls="" controlsList="nodownload"></video>
</div>
</div>
</div>
<div className="clear"></div>
</div>
</div>
);
}
block.json
:
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"title": "mandoe/mandoe-hero",
"model": "0.1.0",
"title": "Mandoe Hero Part",
"class": "textual content",
"icon": "flag",
"description": "A hero part with twin CTA buttons and video",
"attributes": {
"hero_heading": {
"sort": "string"
},
"button_1_cta": {
"sort": "string"
},
"button_2_cta": {
"sort": "string"
},
"number_of_5_star_reviews": {
"sort": "quantity"
},
"hero_image_ID": {
"sort": "quantity",
"default": 0,
"selector": "#mm-hero"
},
"hero_image_URL": {
"sort": "string",
"default": "https://mandoemedia.com/wp-content/uploads/2022/08/Mandoe-digital-signage.jpg",
"selector": "#mm-hero"
},
"hero_image_alt": {
"sort": "string",
"selector": "#mm-hero"
},
"hero_video": {
"sort": "string",
"selector": "#mm-video"
}
},
"helps": {
"html": false
},
"textdomain": "mandoe",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"type": "file:./style-index.css"
}
Can you see the place this error is coming from?
Assist appreciated.