JavaScript · Senior · Question 63 of 75
Why use Reflect.get(target, key, receiver) inside a Proxy get trap?
- ✓Correct answer: It performs the default operation with the correct
receiver, so getters see the proxy asthis - 2It is required syntax; traps fail without it
- 3It makes the proxy faster
Explanation
Returning target[key] calls getters with this === target, bypassing the proxy (and its tracking). Vue's reactivity uses Reflect for this reason.