Vue · Senior · Question 12 of 75
How can changing the key of a component be used intentionally?
<UserForm :key="user.id" :user="user" />- ✓Correct answer: To force a full remount with fresh state when the key changes
- 2To make the component render faster
- 3To pass the key as a prop
Explanation
A new key means a new component instance. It is a simple way to reset forms when switching entities, at the cost of recreating the subtree.