Skip to content

Commit 6efa20f

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] 27 pages modified
1 parent fde28fe commit 6efa20f

15 files changed

+197
-60
lines changed

README.md

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ Building your application with a single state tree is the most straight forward
3333
Separate 3rd party APIs and logic not specific to your application by using **effects**. This will keep your application logic pure and without low level APIs cluttering your code.
3434

3535
{% tabs %}
36-
{% tab title="api.ts" %}
37-
```typescript
38-
export const fetchItems = async (): Promise<Item[]> {
36+
{% tab title="api.js" %}
37+
```javascript
38+
export const fetchItems = async () {
3939
const response = await fetch('/api/items')
4040

4141
return response.json()
@@ -44,9 +44,9 @@ export const fetchItems = async (): Promise<Item[]> {
4444
```
4545
{% endtab %}
4646

47-
{% tab title="actions.ts" %}
47+
{% tab title="actions.js" %}
4848
```typescript
49-
export const loadApp: AsyncAction = ({ state, effects }) => {
49+
export const loadApp = ({ state, effects }) => {
5050
state.items = await effects.api.fetchItems()
5151
}
5252
```
@@ -57,8 +57,8 @@ export const loadApp: AsyncAction = ({ state, effects }) => {
5757

5858
When you build applications that perform many state changes things can get out of hand. In Overmind you can only perform state changes from **actions** and all changes are tracked by the development tool.
5959

60-
```typescript
61-
export const getItems: AsyncAction = async ({ state, effects }) => {
60+
```javascript
61+
export const getItems = async ({ state, effects }) => {
6262
state.isLoadingItems = true
6363
state.items = await effects.api.fetchItems()
6464
state.isLoadingItems = false
@@ -71,8 +71,8 @@ Even though Overmind can create applications with only plain **state** and **act
7171

7272
{% tabs %}
7373
{% tab title="Operators" %}
74-
```typescript
75-
export const search: Operator<string> = pipe(
74+
```javascript
75+
export const search = pipe(
7676
mutate(({ state }, query) => {
7777
state.query = query
7878
}),
@@ -88,16 +88,8 @@ export const search: Operator<string> = pipe(
8888
{% endtab %}
8989

9090
{% tab title="Statechart" %}
91-
```typescript
92-
const loginChart: Statechart<
93-
typeof config,
94-
{
95-
LOGIN: void
96-
AUTHENTICATING: void
97-
AUTHENTICATED: void
98-
ERROR: void
99-
}
100-
> = {
91+
```javascript
92+
const loginChart = {
10193
initial: 'LOGIN',
10294
states: {
10395
LOGIN: {
@@ -129,15 +121,15 @@ const loginChart: Statechart<
129121
{% endtab %}
130122

131123
{% tab title="Class state" %}
132-
```typescript
124+
```javascript
133125
class LoginForm() {
134-
private username: string = ''
135-
private password: string = ''
136-
private validationError: string = ''
137-
changeUsername(username: string) {
126+
private username = ''
127+
private password = ''
128+
private validationError = ''
129+
changeUsername(username) {
138130
this.username = username
139131
}
140-
changePassword(password: string) {
132+
changePassword(password) {
141133
if (!password.match([0-9]) {
142134
this.validationError = 'You need some numbers in your password'
143135
}
@@ -148,11 +140,7 @@ class LoginForm() {
148140
}
149141
}
150142

151-
type State = {
152-
loginForm: LoginForm
153-
}
154-
155-
export const state: State = {
143+
export const state = {
156144
loginForm: new LoginForm()
157145
}
158146
```
@@ -163,7 +151,7 @@ export const state: State = {
163151
164152
Bring in your application configuration of state, effects and actions. Create mocks for any effects. Take a snapshot of mutations performed in an action to ensure all intermediate states are met.
165153
166-
```typescript
154+
```javascript
167155
import { createOvermindMock } from 'overmind'
168156
import { config } from './'
169157

SUMMARY.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
* [Videos](videos-1.md)
77
* [FAQ](faq.md)
88

9-
## Features
9+
## Core
10+
11+
* [State](core/defining-state.md)
12+
* [Actions](core/writing-application-logic.md)
13+
* [Effects](core/running-side-effects.md)
14+
* [Operators](core/going-functional.md)
15+
* [Statecharts](core/statecharts.md)
16+
* [Typescript](core/typescript.md)
1017

11-
* [State](features/defining-state.md)
12-
* [Actions](features/writing-application-logic.md)
13-
* [Effects](features/running-side-effects.md)
14-
* [Typescript](features/typescript.md)
15-
* [Operators](features/going-functional.md)
16-
* [Statecharts](features/statecharts.md)
17-
* [Server Side Rendering](features/server-side-rendering.md)
18-
* [Testing](features/testing.md)
19-
* [GraphQL](features/graphql.md)
18+
## Features
2019

21-
## View layers
20+
## Addons
2221

23-
* [React](view-layers/react.md)
24-
* [Angular](view-layers/angular.md)
25-
* [Vue](view-layers/vue.md)
22+
* [React](addons/react.md)
23+
* [Angular](addons/angular.md)
24+
* [Vue](addons/vue.md)
25+
* [GraphQL](addons/graphql.md)
2626

2727
## Guides <a id="guides-1"></a>
2828

29+
* [Testing](guides-1/testing.md)
2930
* [Structuring the app](guides-1/structuring-the-app.md)
3031
* [Connecting components](guides-1/connecting-components.md)
3132
* [Managing lists](guides-1/managing-lists.md)
3233
* [State first routing](guides-1/state-first-routing.md)
34+
* [Server Side Rendering](guides-1/server-side-rendering.md)
3335

3436
## API <a id="api-1"></a>
3537

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)