Vue · Senior · Question 45 of 75
Why must setup stores return every piece of state?
- ✓Correct answer: Pinia only knows about returned refs; private state breaks SSR serialization, devtools and plugins
- 2Unreturned state causes a syntax error
- 3Returned state becomes read-only
Explanation
If you need privacy, return it and treat it as internal by convention, or use a separate private store. Returned refs become state, computed become getters.