File tree Expand file tree Collapse file tree 4 files changed +58
-1
lines changed
packages/overmind-website Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 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+ ]
Original file line number Diff line number Diff line change 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+ ]
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ Using Overmind with Angular is straight forward. You create a **connect** decora
66h(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
2734h(Example, { name: "guide/usingovermindwithangular/passprop" })
2835```
2936
30- ## OvermindProvider
37+ ## State effects
3138
3239To run effects in components based on changes to state you use the ** addMutationListener** function in the lifecycle hooks of Angular.
3340
Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ You can connect any Vue component to your Overmind instance.
66h(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
1019Any 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
You can’t perform that action at this time.
0 commit comments