Vike
Using Telefunc with Vike.
Examples
Initial Data
For fetching the initial data of pages (SSR data) we use VPS's built-in data fetching mechanism instead of Telefunc.
For example, we can use VPS's onBeforeRender()
hook to fetch inital data directly from a database, see vike.dev > Data Fetching > onBeforeRender()
.
We still use Telefunc for fetching data but only after the initial rendering of the page, for example for pagination or infinite scroll.
In case you're curious: we cannot use Telefunc for server-side rendered (SSR) data because only the framework can pass SSR data from the server to the client-side (which is needed for hydration). This is common to all SSR frameworks like VPS.