Skip to the main content

@trikinco/fullstack-components is no longer maintained.

Concepts

Learn some of the core concepts of fullstack-components.

Getters vs fetchers

All library functionality includes one or more getters and fetchers, as prefixed by get and fetch respectively. The difference between the two is where they can be used, and where third-party API requests are made.

server vs client:

Getters: Server

Getters are Server Actions that call third-party APIs directly on the server. This avoids calling the Next.js API route handler and reduces the back-and-forth communication between client and server.

Use getters to make Server Components and other server functionality.

Getter import example
import { getPrompt } from '@trikinco/fullstack-components'

Fetchers: Client

Fetchers are asynchronous functions that call the internal Next.js API route handler, then the third-party APIs.

Use fetchers to make Client Components and other browser functionality.

Fetcher import example
import { fetchPrompt } from '@trikinco/fullstack-components/client'