Skip to content

Commit

Permalink
docs: add a paragraph about SSR as an optimization technique (#7284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored May 2, 2022
1 parent a6c0078 commit 594d8f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ immer
infima
inlines
intelli
interactiveness
interpolatable
jakepartusch
jamstack
Expand Down
2 changes: 1 addition & 1 deletion website/docs/advanced/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function onRouteUpdate({location, previousLocation}) {
Or, if you are using TypeScript and you want to leverage contextual typing:
```ts title="myClientModule.js"
```ts title="myClientModule.ts"
import type {ClientModule} from '@docusaurus/types';

const module: ClientModule = {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/advanced/ssg.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ These HTML files are the first to arrive at the user's browser screen when a URL

In CSR-only apps, all DOM elements are generated on client side with React, and the HTML file only ever contains one root element for React to mount DOM to; in SSR, React is already facing a fully built HTML page, and it only needs to correlate the DOM elements with the virtual DOM in its model. This step is called "hydration". After React has hydrated the static markup, the app starts to work as any normal React app.

Note that Docusaurus is ultimately a single-page application, so static site generation is only an optimization (_progressive enhancement_, as it's called), but our functionality does not fully depend on those HTML files. This is contrary to site generators like [Jekyll](https://jekyllrb.com/) and [Docusaurus v1](https://v1.docusaurus.io/), where all files are statically transformed to markup, and interactiveness is added through external JavaScript linked with `<script>` tags. If you inspect the build output, you will still see JS assets under `build/assets/js`, which are, really, the core of Docusaurus.

## Escape hatches {#escape-hatches}

If you want to render any dynamic content on your screen that relies on the browser API to be functional at all, for example:
Expand Down

0 comments on commit 594d8f3

Please sign in to comment.