Vue: getting started

Lesson 07 · 11 min

props down, emit up

defineProps reads. defineEmits notifies the parent. Don't write into a prop.

const props = defineProps({ title: { type: String, required: true } }). In the template title is visible by itself. Up: const emit = defineEmits(["saved"]) and emit("saved", id). The parent: @saved="reload". It's the same contract as Input/Output in Angular and props/callbacks in React.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.