Put in order · Vue.js course · Module 2: Template Syntax

Template Ref Syntax

Arrange the template ref code pieces in the order they take effect:

Items to put in order

  • inputRef.value.focus()
  • <input ref="inputRef" />
  • const inputRef = ref(null)
Show the answer

Correct order:

  1. const inputRef = ref(null)
  2. <input ref="inputRef" />
  3. inputRef.value.focus()