Challenge - 5 Problems
Gutenberg Block Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when you add a paragraph block in Gutenberg?
You add a paragraph block in the Gutenberg editor and start typing. What is the expected behavior?
Attempts:
2 left
💡 Hint
Think about how a paragraph block works in a normal text editor.
✗ Incorrect
The paragraph block is designed to accept and display text input immediately as you type, just like a simple text box.
📝 Syntax
intermediate2:00remaining
Which code snippet correctly registers a custom block in Gutenberg?
You want to register a custom block using JavaScript in Gutenberg. Which snippet is correct?
Attempts:
2 left
💡 Hint
Look for the official function to register blocks in the Gutenberg API.
✗ Incorrect
The correct function to register a block is registerBlockType. Other functions do not exist or are incorrect.
❓ state_output
advanced2:00remaining
What is the output when a block's save function returns null?
In a custom Gutenberg block, the save function returns null. What will be the result in the post content?
Attempts:
2 left
💡 Hint
Think about what returning null means for saved content in Gutenberg.
✗ Incorrect
Returning null in the save function means the block does not save any HTML output, so nothing appears on the front end.
🔧 Debug
advanced2:00remaining
Why does this block fail to appear in the editor?
You registered a block but it does not show up in the Gutenberg editor. The code is:
wp.blocks.registerBlockType('my-plugin/sample-block', {
title: 'Sample Block',
edit() {
return wp.element.createElement('p', null, 'Hello');
}
});
What is the likely cause?
Wordpress
wp.blocks.registerBlockType('my-plugin/sample-block', { title: 'Sample Block', edit() { return wp.element.createElement('p', null, 'Hello'); } });
Attempts:
2 left
💡 Hint
Check if all required properties are present in the block registration.
✗ Incorrect
Gutenberg requires both edit and save functions when registering a block. Missing save causes the block not to appear.
🧠 Conceptual
expert3:00remaining
How does the Gutenberg editor handle block serialization?
Which statement best describes how Gutenberg saves block content in the post?
Attempts:
2 left
💡 Hint
Think about how Gutenberg keeps block boundaries in the post content.
✗ Incorrect
Gutenberg wraps each block's saved HTML with special HTML comments to mark block boundaries inside the post content.