Examples for Next.js Pages Router
The AI SDK is designed to work with Next.js Pages Router. The examples will demonstrate querying the language model and rendering the user interfaces using ai/core
and ai/react
, respectively.
Next.js Compatibility
Framework | ai/rsc | ai/core | ai/react |
---|---|---|---|
Next.js App Router | |||
Next.js Pages Router |
Note: The App Router fully supports React Server Components, enhancing your development experience when using
ai/rsc
. This integration makes it easier to manage building Generative User Interfaces and improves Server-Client State Management, offering a more streamlined development process.