You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/going-functional.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,10 +109,6 @@ export const search = pipe(
109
109
{% endtab %}
110
110
{% endtabs %}
111
111
112
-
{% hint style="info" %}
113
-
Note that we give all the actual operator functions the same name as the exported variable that creates it. The reason is that this name is picked up by the devtools and gives you more insight into how your code runs.
114
-
{% endhint %}
115
-
116
112
Now, you might feel that we are just adding complexity here. An additional file with more syntax. But clean and maintainable code is not about less syntax. It is about structure, predictability and reusability. What we achieve with this functional approach is a super readable abstraction in our _actions_ file. There is no logic there, just references to logic. In our _operators_ file each piece of logic is defined in isolation with very little logic and it can be reused in any other composition.
Copy file name to clipboardExpand all lines: core/server-side-rendering.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ export const config = {
16
16
}
17
17
```
18
18
{% endtab %}
19
+
{% endtabs %}
19
20
21
+
{% tabs %}
20
22
{% tab title="index.ts" %}
21
23
```typescript
22
24
import { createOvermind } from'overmind'
@@ -31,14 +33,14 @@ Here we only export the configuration from the main Overmind file. The instantia
31
33
32
34
## Preparing effects
33
35
34
-
The effects will also be shared with the server. Typically this is not an issue, but you should be careful about creating effects that run logic when they are defined. You might also consider lazy-loading effects so that you avoid loading them on the server at all. You can read more about them in [EFFECTS](running-side-effects.md).
36
+
The effects will also be shared with the server. Typically this is not an issue, but you should be careful about creating effects that run logic when they are defined. You might also consider lazy-loading effects so that you avoid loading them on the server at all. You can read more about that in [EFFECTS](running-side-effects.md).
35
37
36
38
## Rendering on the server
37
39
38
40
When you render your application on the server you will have to create an instance of Overmind designed for running on the server. On this instance you can change the state and provide it to your components for rendering. When the components have rendered you can **hydrate** the changes and pass them along to the client so that you can **rehydrate**.
39
41
40
42
{% hint style="info" %}
41
-
Overmind does not hydrate the state, but the mutations you performed. That means it minimizes the payload passed over the wire.
43
+
Overmind does not hydrate the actual state, but the mutations you performed. That means it minimizes the payload passed over the wire.
42
44
{% endhint %}
43
45
44
46
The following shows a very simple example using an [EXPRESS](https://expressjs.com/) middleware to return a server side rendered version of your app.
On the client you just want to make sure that your Overmind instance rehydrates the mutations performed on the server so that when the client renders, it does so with the same state. The **onInitialize** hook of Overmind is the perfect spot to do this.
83
+
On the client you just want to make sure that your Overmind instance rehydrates the mutations performed on the server so that when the client renders, it does so with the same state. The **onInitializeOvermind** hook of Overmind is the perfect spot to do this.
0 commit comments