import type { NextPage } from "next"; import { Header } from "../components/Header"; import dynamic from "next/dynamic"; import { useNetwork } from "wagmi"; import { useEthersSigner } from "../adapters/useEthersSigner"; import { useState } from "react"; /** * Socket Plugin references localStorage. * Since Next js renders the components on the server, the code that references localStorage * is being executed on the server, where localStorage is not available * * Hence Plugin is imported dynamically */ const DynamicBridge = dynamic( // @ts-ignore () => import("@socket.tech/plugin").then((mod) => mod.Bridge), { ssr: false, } ); const Home: NextPage = () => { const { chain } = useNetwork(); const signer = useEthersSigner({ chainId: chain?.id }); const provider = signer?.provider; const [showBridge, setShowBridge] = useState(true); return (

Socket Plugin + NextJs{" "} + Rainbowkit{" "} + Wagmi

This example uses Nextjs, Tailwind CSS, Wagmi, Viem and Rainbowkit

{showBridge && ( )}
); }; export default Home;