Vue · Senior · Question 3 of 75

When should you use markRaw on a value stored in reactive state?

const map = shallowRef(markRaw(new mapboxgl.Map({ container: "map" })));

Explanation

Proxying complex class instances costs performance and can break libraries that compare identities or use private fields. markRaw tells Vue never to convert the object.

Further reading

Problem with a question

Vue · Senior · question 3

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