Next.js

Using Telefunc with Next.js.

Example

Initial Data

For fetching the initial data of pages (SSR data) we use Next.js's built-in data fetching mechanism instead of Telefunc.

For example, we can use Next.js's getServerSideProps to fetch initial data directly from a database, see Next.js Docs > Data Fetching > getServerSideProps.

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 Next.js.