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
It is possible for components to define a `preFetch` hook that will be called server side when rendering the component. This hook should return a promise that will resolve once the component is ready to be rendered.
3
+
It is possible for components to define a `asyncData` hook that will be called server side when rendering the component. This hook should return a promise that will resolve once the component is ready to be rendered.
4
4
5
5
The interesting part in `entry-server.js`:
6
6
7
7
```javascript
8
-
// Call preFetch hooks on components matched by the route.
8
+
// Call fetchData hooks on components matched by the route.
9
9
// A preFetch hook dispatches a store action and returns a Promise,
10
-
// which is resolved when the action is complete and store state has been updated
10
+
// which is resolved when the action is complete and store state has been
The `preFetch` hook will get access to the vuex `store` object to allow the dispatching of vuex action.
17
-
18
-
**Hint**: the `preFetch` hook won't be called client side, this means that you will also need to define the proper fetching actions in the `beforeMount` hook. Usually you should `preFetch` core data and `beforeMount`-fetch all of the data.
20
+
The `asyncData` hook will get access to the vuex `store` object to allow the dispatching of vuex action.
19
21
20
22
## Use cases
21
23
22
24
* Fetching stateless data (page content)
25
+
26
+
## More
27
+
28
+
* Check out [the official documentation for SSR](https://ssr.vuejs.org/en/)
0 commit comments