Skip to content

Commit

Permalink
Update documentation/docs/20-core-concepts/50-state-management.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm authored Jan 5, 2024
1 parent bc925b4 commit e5a1deb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion documentation/docs/20-core-concepts/50-state-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ You might wonder how we're able to use `$page.data` and other [app stores](modul
<p>Welcome {$user.name}</p>
```

Updating the value of a context-based store in deeper-level pages or components will not affect the value in the parent component while the page is being rendered via SSR as the parent component has already been rendered by the time the store value is updated. Once CSR kicks in (if enabled), the value will be propagated and components, pages, and layouts higher in the hierarchy will react to the new value. To avoid values 'flashing' during state updates during hydration, it is generally recommended to pass state down into components rather than up.
Updating the value of a context-based store in deeper-level pages or components while the page is being rendered via SSR will not affect the value in the parent component because it has already been rendered by the time the store value is updated. In contrast, on the client (when CSR is enabled, which is the default) the value will be propagated and components, pages, and layouts higher in the hierarchy will react to the new value. Therefore, to avoid values 'flashing' during state updates during hydration, it is generally recommended to pass state down into components rather than up.

If you're not using SSR (and can guarantee that you won't need to use SSR in future) then you can safely keep state in a shared module, without using the context API.

Expand Down

0 comments on commit e5a1deb

Please sign in to comment.