Data Fetching Tools

With vite-plugin-ssr we keep control over our app architecture; we can integrate any data fetching tool we want simply by following its SSR docs.
Reading Recommendation.

We recommend to be familiar with the following before proceeding.

On a high-level, an SSR integration usually works like this:
  1. We fetch the initial data on the server-side. (We need to do it on the server-side if we want the initial data to be rendered to HTML.)
  2. We make the initial data available as pageContext.initialData.
  3. We make pageContext.initialData available on the browser-side by adding 'initialData' to passToClient.
  4. We initialize any data fetching tool on the browser-side using pageContext.initialData.

Examples: