Skip to content

Commit 12d2b9e

Browse files
docs(website): add docs for new custom connectors
1 parent ac855c5 commit 12d2b9e

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default () => [
2+
{
3+
fileName: 'components/admin.component.ts',
4+
code: `
5+
import { Component } from '@angular/core'
6+
import { connect } from '../overmind'
7+
8+
@Component({
9+
selector: 'admin-root',
10+
templateUrl: './admin.component.html',
11+
styleUrls: ['./admin.component.css']
12+
})
13+
@connect(({ state, actions, effects }) => ({
14+
state: state.admin,
15+
actions: actions.admin
16+
}))
17+
export class AdminComponent {}
18+
`,
19+
},
20+
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default () => [
2+
{
3+
fileName: 'components/SomeComponent.vue (template)',
4+
code: `
5+
<div v-on:click="actions.someAdminAction">
6+
{{state.someAdminState}}
7+
</div>
8+
`,
9+
},
10+
{
11+
fileName: 'components/SomeComponent.vue (script)',
12+
code: `
13+
import { connect } from '../overmind'
14+
15+
export default connect(({ state, actions, effects }) => ({
16+
state: state.admin,
17+
actions: actions.admin
18+
}), {})
19+
`,
20+
},
21+
]

packages/overmind-website/guides/beginner/07_usingovermindwithangular.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Using Overmind with Angular is straight forward. You create a **connect** decora
66
h(Example, { name: "guide/usingovermindwithangular/connect" })
77
```
88

9+
You can also expose parts of the configuration on custom properties of the component:
10+
11+
```marksy
12+
h(Example, { name: "guide/usingovermindwithangular/connect_custom" })
13+
```
14+
15+
You can now access the **admin** state and actions directly with **state** and **actions**.
916

1017
## Rendering
1118

@@ -27,7 +34,7 @@ If you pass a state object or array as a property to a child component you will
2734
h(Example, { name: "guide/usingovermindwithangular/passprop" })
2835
```
2936

30-
## OvermindProvider
37+
## State effects
3138

3239
To run effects in components based on changes to state you use the **addMutationListener** function in the lifecycle hooks of Angular.
3340

packages/overmind-website/guides/beginner/08_usingovermindwithvue.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ You can connect any Vue component to your Overmind instance.
66
h(Example, { name: "guide/usingovermindwithvue/connect" })
77
```
88

9+
You can also expose parts of the configuration on custom properties of the component:
10+
11+
```marksy
12+
h(Example, { name: "guide/usingovermindwithvue/connect_custom" })
13+
```
14+
15+
You can now access the **admin** state and actions directly with **state** and **actions**.
16+
17+
918
## Rendering
1019
Any state accessed in the component will cause the component to render when a mutation occurs on that state. Overmind actually uses the same approach to change detection as Vue itself.
1120

0 commit comments

Comments
 (0)