]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: create a pinia example (#1374) [skip ci]
authorSchalk Neethling <schalk.neethling@mechanical-ink.co.za>
Thu, 16 Jun 2022 07:20:03 +0000 (09:20 +0200)
committerGitHub <noreply@github.com>
Thu, 16 Jun 2022 07:20:03 +0000 (09:20 +0200)
Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
packages/docs/getting-started.md

index 02c181503a02d2fbc175d029e745d9089db71cdd..54e91d9d72438eb969ba9d4b627227b4f0882702 100644 (file)
@@ -14,12 +14,18 @@ If your app is using Vue 2, you also need to install the composition api: `@vue/
 
 If you are using the Vue CLI, you can instead give this [**unofficial plugin**](https://github.com/wobsoriano/vue-cli-plugin-pinia) a try.
 
-Create a pinia (the root store) and pass it to the app:
+Create a pinia instance (the root store) and pass it to the app as a plugin:
 
-```js
+```js{2,5-6,8}
+import { createApp } from 'vue'
 import { createPinia } from 'pinia'
+import App from './App.vue'
+
+const pinia = createPinia()
+const app = createApp(App)
 
-app.use(createPinia())
+app.use(pinia)
+app.mount('#app')
 ```
 
 If you are using Vue 2, you also need to install a plugin and inject the created `pinia` at the root of the app: