Skip to content

Commit 4212b75

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [v28] one page modified
1 parent 29b6fc8 commit 4212b75

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

views/vue.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,29 @@ There are three approaches to connecting Overmind to Vue.
1414
{% tab title="overmind/index.js" %}
1515
```typescript
1616

17-
import { createHooks } from 'overmind-vue/vu3'
17+
import {
18+
createStateHook,
19+
createActionsHook,
20+
createEffectsHook,
21+
createReactionHook
22+
} from 'overmind-vue/vu3'
1823

1924
export const config = {
2025
state: {
2126
foo: 'bar'
2227
},
2328
actions: {
2429
onClick() {}
25-
}
30+
},
31+
effects: {}
2632
}
2733

28-
export const hooks = createHooks()
34+
export const hooks = {
35+
state: createStateHook(),
36+
actions: createActionsHook(),
37+
effects: createEffectsHook(),
38+
reaction: createReactionHook()
39+
}
2940
```
3041
{% endtab %}
3142

@@ -149,7 +160,13 @@ With **TypeScript** you type them by:
149160
```typescript
150161
// overmind/index.ts
151162
import { IContext } from 'overmind'
152-
import {createHooks } from 'overmind-vue/vu3'
163+
164+
import {
165+
createStateHook,
166+
createActionsHook,
167+
createEffectsHook,
168+
createReactionHook
169+
} from 'overmind-vue/vu3'
153170
import { state } from './state'
154171
import * as actions from './actions'
155172

@@ -163,7 +180,12 @@ export type Context = IContext<{
163180
actions: typeof config.actions
164181
}>
165182

166-
export const hooks = createHooks<Context>()
183+
export const hooks = {
184+
state: createStateHook<Context>(),
185+
actions: createActionsHook<Context>(),
186+
effects: createEffectsHook<Context>(),
187+
reaction: createReactionHook<Context>()
188+
}
167189
```
168190
{% endtab %}
169191
{% endtabs %}

0 commit comments

Comments
 (0)