Skip to content

useNuxtApp inside an action throws error #835

Discussion options

You must be logged in to vote

This is normal, it's the same as calling useNuxtApp() inside a component method rather that at the setup() level. You need to put it in a plugin instead:

pinia.use(() => ({ $app: markRaw(useNuxtApp()) }))

You have access to the nuxt context as this.$nuxt but I can't remember if it contains the nuxt app and all the differences between Nuxt 2, bridge, and 3

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by posva
Comment options

You must be logged in to vote
2 replies
@posva
Comment options

@liqueflies
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants