State Provider

Learn how we implement the state provider in Vue using provide/inject methods.

We'll cover the following

The State Provider patternThe State Provider pattern provides state to the whole application, or only a specific component tree. is inspired by the combination of React’s Hooks and Context API. In Vue, it’s done by using the provide/inject methods. Though this pattern was already possible in Vue 2, it was unpopular. It might be because values passed through provide aren’t reactive by default. Overall, working with provide/inject through Options API isn’t as easy compared to using it through Composition API.

Spinner

Imagine an application that needs to display an overlay with a spinner over the rest of the app, as shown below.

Get hands-on with 1200+ tech skills courses.