Pinia là official state management library cho Vue 3 — thay thế Vuex.
Ưu điểm:
- Composition API-friendly, không cần mutations
- TypeScript support tốt hơn nhiều
- Không có nested modules, mỗi store là một module độc lập
- Bundle nhỏ hơn (~1KB)
- Devtools support, hot-reload
- Server-side rendering support. Vuex 4 (dành cho Vue 3) hiện ở maintenance-only mode; Vuex 5 đã bị hủy — Pinia là official successor
Pinia is the official state management library for Vue 3 — replacing Vuex.
Advantages:
- Composition API-friendly, no mutations needed
- Significantly better TypeScript support
- No nested modules — each store is an independent module
- Smaller bundle (~1KB)
- Devtools support, hot-reload
- SSR support. Vuex 4 (for Vue 3) is in maintenance-only mode; Vuex 5 was cancelled — Pinia is the official successor