My Top 5 Tips for using Pinia

I've had a lot of experience with Pinia, not just because I created it but because I often use it in my projects and review other people's code that use it! On top of that I often give talks about what I find useful to others. This gives me some unique insights and in this article I want to share my top 5 tips for using Pinia.

Here's the TL;DR:

  • Don't create useless getters
  • Use composables in Option Stores
  • Use Setup Stores for complex composables
  • Use Setup Stores to inject globals like the Router
  • How to create private State

Dive into each of these tips in this article.