@@ -10,6 +10,9 @@ npm install @neabyte/stateless-js
1010
1111# React (Automatic Re-renders)
1212npm install @neabyte/stateless-js react
13+
14+ # Vue (Automatic Reactivity)
15+ npm install @neabyte/stateless-js vue
1316```
1417
1518## 🔧 Module Support
@@ -25,6 +28,9 @@ import { createStateless, useStateless } from '@neabyte/stateless-js'
2528// React (Automatic Re-renders)
2629import { useReactStateless } from ' @neabyte/stateless-js/react'
2730
31+ // Vue (Automatic Reactivity)
32+ import { useVueStateless } from ' @neabyte/stateless-js/vue'
33+
2834// TypeScript types
2935import type { StateSetter , StateValue } from ' @neabyte/stateless-js'
3036```
@@ -76,7 +82,28 @@ function Counter() {
7682}
7783```
7884
79- ### 🔄 State Sharing (Universal & React)
85+ ### 🟢 Vue Usage
86+
87+ ``` typescript
88+ import { useVueStateless } from ' @neabyte/stateless-js/vue'
89+
90+ export default {
91+ name: ' Counter' ,
92+ setup() {
93+ const [setCount, countValue] = useVueStateless (' counter' , 0 )
94+ const count = computed (() => countValue .value )
95+ const increment = () => {
96+ setCount (current => current + 1 )
97+ }
98+ return {
99+ count ,
100+ increment
101+ }
102+ }
103+ }
104+ ```
105+
106+ ### 🔄 State Sharing (Universal, React & Vue)
80107
81108``` typescript
82109// Universal
@@ -96,6 +123,28 @@ function UserEditor() {
96123 Increase Age
97124 </button >
98125}
126+
127+ // Vue - Multiple components share the same state
128+ export default {
129+ name: 'UserProfile',
130+ setup() {
131+ const [setUser , userValue ] = useVueStateless('user', { name: ' John' , age: 25 })
132+ const user = computed (() => userValue .value )
133+ return { user }
134+ }
135+ }
136+
137+ export default {
138+ name: ' UserEditor' ,
139+ setup() {
140+ const [setUser, userValue] = useVueStateless (' user' , { name: ' Default' , age: 0 })
141+ const user = computed (() => userValue .value )
142+ const increaseAge = () => {
143+ setUser (u => ({ ... u , age: u .age + 1 }))
144+ }
145+ return { user , increaseAge }
146+ }
147+ }
99148```
100149
101150### 🎯 Different Data Types
@@ -123,9 +172,17 @@ const [setBigInt, big] = createStateless('bigint', BigInt(123))
123172### 🔧 Object Updates
124173
125174``` typescript
175+ // Universal
126176const [setData, data] = createStateless (' data' , { count: 0 , items: [] })
127177
128- // Immutable updates
178+ // React
179+ const [setData, data] = useReactStateless (' react-data' , { count: 0 , items: [] })
180+
181+ // Vue
182+ const [setData, dataRef] = useVueStateless (' vue-data' , { count: 0 , items: [] })
183+ const data = computed (() => dataRef .value )
184+
185+ // Immutable updates work the same way
129186setData (current => ({ ... current , count: current .count + 1 }))
130187setData (current => ({ ... current , items: [... current .items , ' new item' ] }))
131188```
@@ -181,6 +238,16 @@ React hook that provides automatic re-renders when state changes.
181238- ` initialValue ` : Initial value for the state
182239- Returns: Tuple ` [StateSetter<T>, T] ` (direct value, not StateValue object)
183240
241+ ### Vue Functions
242+
243+ #### ` useVueStateless<T>(id: StateId, initialValue: T): [StateSetter<T>, Ref<T>] `
244+
245+ Vue composable that provides automatic reactivity when state changes.
246+
247+ - ` id ` : Unique identifier (string or number)
248+ - ` initialValue ` : Initial value for the state
249+ - Returns: Tuple ` [StateSetter<T>, Ref<T>] ` (reactive ref for Vue reactivity)
250+
184251### Types
185252
186253#### ` StateSetter<T> `
0 commit comments