## Usage
+### Install the plugin
+
+Create a pinia (the root store) and pass it to app:
+
+```js
+import { createPinia } from 'pinia'
+
+app.use(createPinia())
+```
+
+This will also add devtools support.
+**NOTE**: this API is still experimental and is currently only used for devtools support but that might change in the future
+
### Creating a Store
You can create as many stores as you want, and they should each exist in different files:
return store
}
+// only warn the dev once
+let isDevWarned: boolean | undefined
+
/**
* Creates a `useStore` function that retrieves the store instance
* @param options - options to define the store
const app = getClientApp()
if (app) {
addDevtools(app, store, req)
- } else {
+ } else if (!isDevWarned && !__TEST__) {
+ isDevWarned = true
console.warn(
`[🍍]: store was instantiated before calling\n` +
`app.use(pinia)\n` +
`Make sure to install pinia's plugin by using createPinia:\n` +
- `linkto docs TODO`
+ `https://github.com/posva/pinia/tree/v2#install-the-plugin\n` +
+ `It will enable devtools and overall a better developer experience.`
)
}
}