Vue · Senior · Question 49 of 75

When would you write a render function with h()?

const Heading = (props, { slots }) => h(`h${props.level}`, slots.default?.());

Explanation

Functional components like this have no state or instance. For most UI, templates are clearer and better optimized.

Further reading

Problem with a question

Vue · Senior · question 49

Test yourself

Take the Vue · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz