Skip to content

Commit 45a6b56

Browse files
callumacraechrisvfritz
authored andcommitted
Make where id="app" comes from clearer (vuejs#147)
I got confused, hopefully this will help someone else!
1 parent 30a085b commit 45a6b56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

en/hydration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ app.$mount('#app')
99

1010
Since the server has already rendered the markup, we obviously do not want to throw that away and re-create all the DOM elements. Instead, we want to "hydrate" the static markup and make it interactive.
1111

12-
If you inspect the server-rendered output, you will notice that the app's root element has a special attribute:
12+
If you inspect the server-rendered output, you will notice that the app's root element has had a special attribute added:
1313

1414
``` js
1515
<div id="app" data-server-rendered="true">
1616
```
1717

18-
The `data-server-rendered` special attribute lets the client-side Vue know that the markup is rendered by the server and it should mount in hydration mode.
18+
The `data-server-rendered` special attribute lets the client-side Vue know that the markup is rendered by the server and it should mount in hydration mode. Note that it didn't add `id="app"`, just the `data-server-rendered` attribute: you need to add the ID or some other selector to the app's root element yourself or the app won't hydrate properly.
1919

2020
In development mode, Vue will assert the client-side generated virtual DOM tree matches the DOM structure rendered from the server. If there is a mismatch, it will bail hydration, discard existing DOM and render from scratch. **In production mode, this assertion is disabled for maximum performance.**
2121

0 commit comments

Comments
 (0)