Challenge - 5 Problems
Render Function Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What does this Vue render function output?
Consider this Vue 3 render function using
h from vue. What will it render in the browser?Vue
import { h } from 'vue'; export default { render() { return h('div', { class: 'container' }, [ h('h1', 'Hello World'), h('p', 'This is a render function example.') ]); } }
Attempts:
2 left
💡 Hint
Look at the tag names and class attributes used in the render function.
✗ Incorrect
The render function creates a
with class 'container' containing an
and a
with the given text. So option A matches exactly.
📝 Syntax
intermediate2:00remaining
Which render function syntax is correct for a Vue 3 functional component?
Select the correct render function syntax for a Vue 3 functional component that renders a
Attempts:
2 left
💡 Hint
Vue 3 functional components use setup returning a render function.
✗ Incorrect
In Vue 3, functional components are defined by a setup function returning a render function. Option B follows this pattern.
🔧 Debug
advanced2:00remaining
What error does this Vue render function produce?
Identify the error when running this Vue 3 render function code:
Vue
import { h } from 'vue'; export default { render() { return h('div', { className: 'box' }, 'Content'); } }
Attempts:
2 left
💡 Hint
Vue uses 'class' attribute, not 'className' like React.
✗ Incorrect
Vue render functions expect 'class' for CSS classes, not 'className'. Using 'className' triggers a warning about unknown property.
❓ state_output
advanced2:00remaining
What is the output after clicking the button in this Vue render function component?
Given this Vue 3 component with a render function and state, what text will the button show after one click?
Vue
import { h, ref } from 'vue'; export default { setup() { const count = ref(0); function increment() { count.value++; } return () => h('button', { onClick: increment }, `Count: ${count.value}`); } }
Attempts:
2 left
💡 Hint
Reactive refs accessed inside render functions create dependencies that trigger re-renders.
✗ Incorrect
When setup() returns a render function in Vue 3, accessing count.value inside it tracks the ref as a dependency. The increment() updates the ref, triggering a re-render where the new value '1' is read and displayed.
🧠 Conceptual
expert2:00remaining
Which statement about Vue 3 render functions is true?
Choose the correct statement about Vue 3 render functions and their usage.
Attempts:
2 left
💡 Hint
Think about how Vue 3 handles fragments in render functions.
✗ Incorrect
Vue 3 supports fragments, so render functions can return arrays of elements without a wrapper. JSX is optional, and reactive state is accessible in setup.