Skip to content

Commit 5d24680

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] 2 pages modified
1 parent 63a979a commit 5d24680

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
## Guides <a id="guides-1"></a>
3232

3333
* [Connecting components](guides-1/connecting-components.md)
34+
* [Connecting to React Native](https://dev.to/brasilikum/how-to-setup-overmind-with-react-native-expo-optional-4mk5)
3435
* [Managing lists](guides-1/managing-lists.md)
3536
* [State first routing](guides-1/state-first-routing.md)
3637
* [Server Side Rendering](guides-1/server-side-rendering.md)

core/defining-state.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ You set an **initial** state and then you create a relationship between the diff
387387
export const login = async ({ state, effects }) => {
388388
return state.mode.authenticating(async () => {
389389
try {
390-
const user = effects.api.getUser()
390+
const user = await effects.api.getUser()
391391
return state.mode.authenticated(() => {
392392
state.user = user
393393
})
@@ -418,8 +418,8 @@ export const logout = async ({ state, effects }) => {
418418
{% hint style="warning" %}
419419
There are two important rules for predictable transitions:
420420

421-
1. The transition should always **return**
422-
2. **Async** transitions should not **mutate** state
421+
1. The transition should always be **returned**
422+
2. A transition can either run **async** OR **mutate**, not both
423423
{% endhint %}
424424

425425
What is important to realize here is that our logic is separated into **allowable** transitions. That means when we are waiting for the user on **line 4** and some other logic has changed the state to **unauthenticated** in the meantime, the user will not be set, as the **authenticated** transition is now not possible. This is what state machines do. They group logic into states that are allowed to run, preventing invalid logic to run.

0 commit comments

Comments
 (0)