Skip to content

Using Pinia as a local state manager for a page with complex, multi-layered components #2266

Closed Answered by posva
guypassy asked this question in Help and Questions
Discussion options

You must be logged in to vote

a. Does not currently have very good typescript support.

It does 👀 , check the InjectionKey type.

b. Cannot be called from within a composable. Provide/Inject must be called from a Vue component's setup function/script block.

It can: a composable is called within a Vue Component (some other very specific places also work for global provide app.provide() only, like stores and navigation guards), therefore the composable creates everything within the context of the Vue Component itself.

I also suspect you don't need pinia (or state management for this). The new defineModel() for custom input elements should help with the boilerplate within custom input components.
When it comes to Form …

Replies: 1 comment 2 replies

Comment options

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

@posva
Comment options

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