Skip to content

Commit a5d3eb2

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] 3 pages modified
1 parent d46e617 commit a5d3eb2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

computed-values.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Computed values
22

3-
Sometimes you want to computed a value based on some input and the current state of the application. That is why we have the concept of a **computed**.
3+
Sometimes you want to compute a value based on some input and the current state of the application. That is why we have the concept of a **computed**.
44

55
{% code-tabs %}
66
{% code-tabs-item title="app/computed.js" %}
@@ -24,7 +24,7 @@ import { computed } from 'overmind'
2424
import { State } from './state'
2525

2626
export type UsersListConfig {
27-
isAweome: boolean
27+
isAwesome: boolean
2828
sortField: string
2929
startIndex: number
3030
endIndex: number
@@ -79,3 +79,5 @@ export default {
7979

8080
You use a computed by calling it and giving it an argument, like **config** in this example.
8181

82+
Comuted values are also tracked by the devtools and shows up in the devtools state overview with details about the current value, how many times it has executed and cache information.
83+

get-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default state
8383
```javascript
8484
export default action => ({
8585
changeTitle: action()
86-
.map(event => event.target.value)
86+
.map((_, event) => event.target.value)
8787
.mutation((state, title) => state.title = title)
8888
})
8989
```

reactions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const app = new App({
1515
},
1616
reactions: (reaction, action) => {
1717
const storeFooInStorage = action()
18-
.do((_, { storage, state }) => storage.set('foo', state.foo))
18+
.do(({ storage, state }) => storage.set('foo', state.foo))
1919

2020
return {
2121
storeFoo: reaction(state => state.foo, storeFooInStorage)
@@ -30,7 +30,7 @@ What to take notice of is that if the returned state of the reaction was an arra
3030

3131
### Component reactions
3232

33-
Component reactions differ in the sense that they only live through the component lifecycle. They are unregistered when the component unmounts. Also you are likely to not use the actions passed to the second callback.
33+
Component reactions differ in the sense that they only live through the component lifecycle. They are unregistered when the component unmounts. Also you do not pass it an action, but a regular callback to run when the reaction triggers.
3434

3535
{% tabs %}
3636
{% tab title="React" %}
@@ -41,7 +41,7 @@ import { connect } from '../app'
4141
class MyComponent extends React.Component {
4242
componentDidMount () {
4343
this.props.app.reaction(
44-
'focusInputOnFooChange',
44+
'focusInput',
4545
state => state.foo,
4646
() => this.input.focus()
4747
)

0 commit comments

Comments
 (0)