Bird
0
0

Identify the error in this block registration code:

medium📝 Debug Q6 of 15
Wordpress - Content Management
Identify the error in this block registration code:
registerBlockType('my-plugin/block', { edit: () => 

Hi

, save: () =>

Hi

});
AThe edit function must be a class component.
BMissing import of registerBlockType from '@wordpress/blocks'.
CThe save function cannot return JSX.
DBlock name should not contain a slash.
Step-by-Step Solution
Solution:
  1. Step 1: Check for required imports

    registerBlockType must be imported from '@wordpress/blocks' to be used.
  2. Step 2: Validate other code parts

    Using functional components for edit and save is valid; JSX return is allowed; block names require a slash.
  3. Final Answer:

    Missing import of registerBlockType from '@wordpress/blocks'. -> Option B
  4. Quick Check:

    Missing import causes error [OK]
Quick Trick: Always import registerBlockType before use [OK]
Common Mistakes:
  • Thinking edit must be class component
  • Believing save cannot return JSX
  • Removing slash from block name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes