Skip to content

Commit 0111ad9

Browse files
docs(website): update docs for new version
1 parent 0099786 commit 0111ad9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+695
-169
lines changed

packages/node_modules/overmind-react/src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ export const createHook = <Config extends IConfiguration>(
6363
effects: Overmind<Config>['effects']
6464
addMutationListener: Overmind<Config>['addMutationListener']
6565
}) => {
66+
if (overmindInstance) {
67+
console.warn(
68+
'DEPRECATION - Do not pass the overmind instance to "createHook", but use the provider. Please read docs for more information'
69+
)
70+
}
6671
let currentComponentInstanceId = 0
6772
const {
6873
ReactCurrentOwner,
@@ -186,6 +191,12 @@ export const createConnect = <ThisConfig extends IConfiguration>(
186191
keyof IConnect<Overmind<ThisConfig>>
187192
>
188193
> => {
194+
if (overmindInstance) {
195+
console.warn(
196+
'DEPRECATION - Do not pass the overmind instance to "createConnect", but use the provider. Please read docs for more information'
197+
)
198+
}
199+
189200
let componentInstanceId = 0
190201
const name = component.name
191202
const populatedComponent = component as any

packages/overmind-website/examples/api/app_initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { state } from './state'
1212
import * as effects from './effects'
1313
import * as actions from './actions'
1414
15-
const config = {
15+
export const config = {
1616
state,
1717
effects,
1818
actions

packages/overmind-website/examples/api/onInitialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import onInitialize from './onInitialize'
2929
import { state } from './state'
3030
import * as actions from './actions'
3131
32-
const config = {
32+
export const config = {
3333
onInitialize,
3434
state,
3535
actions

packages/overmind-website/examples/guide/connectingcomponents/actions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,20 @@ export const toggleAwesomeApp: Action = ({ state }) =>
9494
fileName: 'components/app.component.ts',
9595
code: `
9696
import { Component } from '@angular/core';
97-
import { connect } from '../overmind'
97+
import { Store } from '../overmind'
9898
9999
@Component({
100100
selector: 'app-root',
101101
template: \`
102-
<button (click)="overmind.actions.toggleAwesomeApp()">
102+
<button (click)="actions.toggleAwesomeApp()">
103103
Toggle awesome
104104
</button>
105105
\`
106106
})
107-
@connect()
108-
export class App {}
107+
export class App {
108+
actions = this.store.actions
109+
constructor(private store: Store) {}
110+
}
109111
`,
110112
},
111113
],

packages/overmind-website/examples/guide/connectingcomponents/array_1.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ export default List
5656
fileName: 'components/list.component.ts',
5757
code: `
5858
import { Component } from '@angular/core';
59-
import { connect } from '../overmind'
59+
import { Store } from '../overmind'
6060
6161
@Component({
6262
selector: 'app-list',
6363
template: \`
64-
<h1>{{overmind.state.items}}</h1>
64+
<h1 *track>{{state.items}}</h1>
6565
\`
6666
})
67-
@connect()
68-
export class List {}
67+
export class List {
68+
state = this.store.select()
69+
constructor(private store: Store) {}
70+
}
6971
`,
7072
},
7173
],

packages/overmind-website/examples/guide/connectingcomponents/array_2.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,21 @@ export default App
6868
fileName: 'components/list.component.ts',
6969
code: `
7070
import { Component } from '@angular/core';
71-
import { connect } from '../overmind'
71+
import { Store } from '../overmind'
7272
7373
@Component({
7474
selector: 'app-list',
7575
template: \`
7676
<ul>
77-
<li *ngFor="let item of overmind.state.items;trackby: trackById">
77+
<li *ngFor="let item of state.items;trackby: trackById">
7878
{{item.title}}
7979
</li>
8080
</ul>
8181
\`
8282
})
83-
@connect()
8483
export class List {
84+
state = this.store.select()
85+
constructor(private store: Store) {}
8586
trackById(index, item) {
8687
return item.id
8788
}

packages/overmind-website/examples/guide/connectingcomponents/array_3.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export default {
8787
const typescript = {
8888
react: [
8989
{
90-
fileName: 'components/Item.jsx',
90+
fileName: 'components/Item.tsx',
9191
code: `
92-
import React from 'react'
92+
import * as React from 'react'
9393
import { useOvermind } from '../overmind'
9494
9595
type Props = {
@@ -142,12 +142,11 @@ import { Item } from '../overmind/state'
142142
@Component({
143143
selector: 'app-list-item',
144144
template: \`
145-
<li>
145+
<li *track>
146146
{{item.title}}
147147
</li>
148148
\`
149149
})
150-
@connect()
151150
export class List {
152151
@Input() item: Item;
153152
}
@@ -157,21 +156,22 @@ export class List {
157156
fileName: 'components/list.component.ts',
158157
code: `
159158
import { Component } from '@angular/core';
160-
import { connect } from '../overmind'
159+
import { Store } from '../overmind'
161160
162161
@Component({
163162
selector: 'app-list',
164163
template: \`
165-
<ul>
164+
<ul *track>
166165
<app-list-item
167-
*ngFor="let item of overmind.state.items;trackby: trackById"
166+
*ngFor="let item of state.items;trackby: trackById"
168167
[item]="item"
169168
></app-list-item>
170169
</ul>
171170
\`
172171
})
173-
@connect()
174172
export class List {
173+
state = this.store.select()
174+
constructor(private store: Store) {}
175175
trackById(index, item) {
176176
return item.id
177177
}

packages/overmind-website/examples/guide/connectingcomponents/effects.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,19 @@ export default Article
8484
fileName: 'app.component.ts',
8585
code: `
8686
import { Component } from '@angular/core';
87-
import { connect, Connect } from '../overmind'
87+
import { Store } from '../overmind'
8888
8989
@Component({
9090
selector: 'app-root',
9191
template: \`
9292
<article></article>
9393
\`
9494
})
95-
@connect()
9695
export class App {
97-
overmind: Connect
9896
disposeEffect: () => void
97+
constructor(private store: Store) {}
9998
ngOnInit() {
100-
this.disposeEffect = this.overmind.addMutationListener(() => {
99+
this.disposeEffect = this.store.addMutationListener(() => {
101100
if (mutation.path === 'currentArticle') {
102101
document.querySelector('#app').scrollTop = 0
103102
}

packages/overmind-website/examples/guide/connectingcomponents/object_1.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ export default List
5656
fileName: 'components/list.component.ts',
5757
code: `
5858
import { Component } from '@angular/core';
59-
import { connect } from '../overmind'
59+
import { Store } from '../overmind'
6060
6161
@Component({
6262
selector: 'app-list',
6363
template: \`
64-
<h1>{{overmind.state.items}}</h1>
64+
<h1>{{state.items}}</h1>
6565
\`
6666
})
67-
@connect()
68-
export class List {}
67+
export class List {
68+
state = this.store.select()
69+
constructor(private store: Store) {}
70+
}
6971
`,
7072
},
7173
],

packages/overmind-website/examples/guide/connectingcomponents/object_2.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export default {
8787
const typescript = {
8888
react: [
8989
{
90-
fileName: 'components/Item.jsx',
90+
fileName: 'components/Item.tsx',
9191
code: `
92-
import React from 'react'
92+
import * as React from 'react'
9393
import { useOvermind } from '../overmind'
9494
9595
type Props = {
@@ -136,18 +136,16 @@ export default List
136136
fileName: 'components/item.component.ts',
137137
code: `
138138
import { Component Input } from '@angular/core';
139-
import { connect } from '../overmind'
140139
import { Item } from '../overmind/state'
141140
142141
@Component({
143142
selector: 'app-list-item',
144143
template: \`
145-
<li>
144+
<li *track>
146145
{{item.title}}
147146
</li>
148147
\`
149148
})
150-
@connect()
151149
export class List {
152150
@Input() item: Item;
153151
}
@@ -157,22 +155,23 @@ export class List {
157155
fileName: 'components/list.component.ts',
158156
code: `
159157
import { Component } from '@angular/core';
160-
import { connect } from '../overmind'
158+
import { Store } from '../overmind'
161159
162160
@Component({
163161
selector: 'app-list',
164162
template: \`
165-
<ul>
163+
<ul *track>
166164
<app-list-item
167-
*ngFor="let id of keys(overmind.state.items);trackby: trackById"
168-
[item]="overmind.state.items[id]"
165+
*ngFor="let id of keys(state.items);trackby: trackById"
166+
[item]="state.items[id]"
169167
></app-list-item>
170168
</ul>
171169
\`
172170
})
173-
@connect()
174171
export class List {
172+
state = this.store.select()
175173
keys = Object.keys
174+
constructor(private store: Store) {}
176175
trackById(index, id) {
177176
return id
178177
}

0 commit comments

Comments
 (0)