Integrate the widget with your Next.js, Remix or Nuxt application
LI.FI Widget is fully compatible with Next.js applications and requires minimal configuration for seamless integration.
Due to the nature of server-side rendering (SSR) in Next.js and how different wallet libraries manage their connections to wallet extensions, the LI.FI Widget needs to be specifically rendered on the client side. To achieve this, make use of the 'use client'
directive, which ensures that the widget component is only rendered in the client-side environment.
Please take a look at our complete example in the widget repository here.
Let's take a look at the example of how you can add the widget to a Next.js page:
As you can see from the Next.js example, for users convenience we provide the WidgetSkeleton
component that can be used as a fallback while the main widget component is being loaded.
The WidgetSkeleton
component is currently only tested within the Next.js environment and might not work with other SSR frameworks.
Please check out our complete examples for Remix, Nuxt and Gatsby.
We are continuously working on improving our support for more frameworks.