Copy // next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode : true ,
swcMinify : true ,
transpilePackages : [ '@lifi/widget' , '@lifi/wallet-management' ] ,
};
module . exports = nextConfig;
index.tsx components/Widget.tsx components/LoadingIndicator.tsx
Copy import type { NextPage } from 'next' ;
import dynamic from 'next/dynamic' ;
import { LoadingIndicator } from '../components/LoadingIndicator' ;
export const LiFiWidgetNext = dynamic (
() => import ( '../components/Widget' ) .then ((module) => module .Widget) as any ,
{
ssr : false ,
loading : () => < LoadingIndicator /> ,
} ,
);
const Home : NextPage = () => {
return < LiFiWidgetNext />;
};
export default Home;
Copy import { LiFiWidget } from '@lifi/widget' ;
export const Widget = () => {
return (
< LiFiWidget
config = {{
containerStyle : {
border : `1px solid rgb(234, 234, 234)` ,
borderRadius : '16px' ,
} ,
}}
integrator = "nextjs-example"
/>
);
};
Copy // components/LoadingIndicator.tsx
export const LoadingIndicator = () => {
return (
< div
style = {{
display : 'grid' ,
placeItems : 'center' ,
}}
>
< p >Loading...</ p >
</ div >
);
};