All Projects → resessh → vue-unstated

resessh / vue-unstated

Licence: MIT license
A tiny state management library for Vue Composition API.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-unstated

v-intl
Add i18n to your awesome Vue 3 app 🔉
Stars: ✭ 13 (-56.67%)
Mutual labels:  vue2, vue3, vue-composition-api, composition-api
vue-snippets
Visual Studio Code Syntax Highlighting For Vue3 And Vue2
Stars: ✭ 25 (-16.67%)
Mutual labels:  vue2, vue3, composition-api
Vue3 News
🔥 Find the latest breaking Vue3、Vue CLI 3+ & Vite News. (2021)
Stars: ✭ 2,416 (+7953.33%)
Mutual labels:  vue3, vue-composition-api, composition-api
vuse-rx
Vue 3 + rxjs = ❤
Stars: ✭ 52 (+73.33%)
Mutual labels:  state-management, vue3, composition-api
vue
Vue integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores
Stars: ✭ 25 (-16.67%)
Mutual labels:  state-management, store, vue3
v-pip
🖼 Tiny vue wrapper for supporting native picture-in-picture mode.
Stars: ✭ 30 (+0%)
Mutual labels:  vue2, vue3, composition-api
janak
Your next vue.js package!
Stars: ✭ 26 (-13.33%)
Mutual labels:  vue2, vue3, vue-composition-api
vue-pattern-input
Use RegExp to limit input
Stars: ✭ 25 (-16.67%)
Mutual labels:  vue2, vue3
vuelve
A declarative syntax for the Composition API in Vue 3.
Stars: ✭ 38 (+26.67%)
Mutual labels:  vue3, composition-api
vue3-chat
2021👨‍🎓Vue2/3全家桶 + Koa+Socket+Vant3前后端分离移动端聊天应用。vue+node全栈入门项目
Stars: ✭ 46 (+53.33%)
Mutual labels:  vue2, vue3
vue-reuse
基于composition-api的hooks函数库
Stars: ✭ 28 (-6.67%)
Mutual labels:  vue3, composition-api
toggle
Vue 3 toggle component with labels, custom slots and styling options (+Tailwind CSS support).
Stars: ✭ 75 (+150%)
Mutual labels:  vue2, vue3
query-param-store
Angular Reactive Query Parameters Store
Stars: ✭ 15 (-50%)
Mutual labels:  state-management, store
vue-reactive-store
A VueX alternative : declarative + reactive + centralized way to structure your data store. Inspired by VueX and Vue.js . Compatible with vue-devtools.
Stars: ✭ 27 (-10%)
Mutual labels:  state-management, store
vesselize
⛵ A JavaScript IoC container that works seamlessly with Vue.js and React.
Stars: ✭ 22 (-26.67%)
Mutual labels:  vue-composition-api, composition-api
v-drag
The simplest way to integrate dragging on Vue.js
Stars: ✭ 71 (+136.67%)
Mutual labels:  vue2, vue3
veact
Mutable state enhancer library for React based on @vuejs
Stars: ✭ 62 (+106.67%)
Mutual labels:  vue-composition-api, composition-api
okito
Your best flutter coding friend. All in one; state management, navigation management(with dynamic routing), local storage, localization, dependency injection, cool extensions with best usages and with the support of best utilities!
Stars: ✭ 37 (+23.33%)
Mutual labels:  state-management, store
vue-next-rx
RxJS integration for Vue next
Stars: ✭ 31 (+3.33%)
Mutual labels:  vue3, composition-api
g2plot-vue
g2plot for vue, both 2 and 3
Stars: ✭ 106 (+253.33%)
Mutual labels:  vue2, vue3

logo

version Build Test codecov minzipped size typescript


vue-unstated

A tiny state management library for Vue Composition API based on unstated-next which is for React.

🏇 Demo

Edit [vue-unstated DEMO] Todo

🔌 Installation

$ npm install --save vue-unstated

or

$ yarn add vue-unstated

🏄 Usage

use/counter.js

import { reactive } from '@vue/composition-api' // Vue 2 with @vue/composition-api
import { reactive } from 'vue' // or Vue 3
import { createContainer } from 'vue-unstated'

const useCounter = (initialState = { count: 0 }) => {
  const state = reactive(initialState)

  const increment = () => {
    state.count++
  }

  return { state, increment }
}

export const counterContainer = createContainer(useCounter)

Parent.vue

<script>
import { counterContainer } from 'use/counter'
import Child from 'Child.vue'

export default {
  components: { Child },
  setup() {
    // You can share same state in its child nodes!!
    const { state, increment } = counterContainer.provide()

    return {
      count: state.count,
      increment,
    }
  }
}
</script>

Child.vue

<script>
import { counterContainer } from 'use/counter'

export default {
  setup() {
    // You can use same state with Parent.vue!!
    const { state, increment } = counterContainer.useContainer()

    return {
      count: state.count,
      increment,
    }
  }
}
</script>

🏁 LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].