This is a Next.js project bootstrapped with create-next-app.
This repository shows how to integrate Widget into the latest Next.js App Router projects.
NOTE: If you are using Pages Router, check out
examples/nextjs14-page-router(Next.js version 14).
Examples can be found at the following paths:
- http://localhost:3000/ - Shows the use of <ClientOnly /> to import and use the Widget
- http://localhost:3000/dynamic-import - Shows the use of
next/dynamicAPI to import and use the Widget
NB: Passing fallback and config to Widget is optional. Use WidgetEvents component to react to Widget events as needed.
NB: Use AppRouterCacheProvider for MUI compatibility with Next.js App Router. See example in app/layout.tsx.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.