mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
reorganize providers
This commit is contained in:
parent
a8ba2397bd
commit
530fb860c3
@ -1,5 +1,7 @@
|
||||
import type { Metadata } from "next";
|
||||
import "./globals.css";
|
||||
|
||||
import "~/app/globals.css";
|
||||
import { Providers } from "~/app/providers";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Farcaster Frames v2 Demo",
|
||||
@ -13,7 +15,9 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
<body>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,9 +1,15 @@
|
||||
import { App } from "~/components/App";
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const Demo = dynamic(() => import("~/components/Demo"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="min-h-screen flex flex-col p-4">
|
||||
<App />
|
||||
<Demo />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
14
src/app/providers.tsx
Normal file
14
src/app/providers.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const WagmiProvider = dynamic(
|
||||
() => import("~/components/providers/WagmiProvider"),
|
||||
{
|
||||
ssr: false,
|
||||
}
|
||||
);
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return <WagmiProvider>{children}</WagmiProvider>;
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const Demo = dynamic(() => import("./Demo"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const WagmiConfig = dynamic(() => import("./WagmiProvider"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<WagmiConfig>
|
||||
<Demo />
|
||||
</WagmiConfig>
|
||||
);
|
||||
}
|
||||
@ -10,7 +10,7 @@ import {
|
||||
useConnect,
|
||||
} from "wagmi";
|
||||
|
||||
import { config } from "~/components/WagmiProvider";
|
||||
import { config } from "~/components/providers/WagmiProvider";
|
||||
import { Button } from "~/components/ui/Button";
|
||||
import { truncateAddress } from "~/lib/truncateAddress";
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { createConfig, http, WagmiProvider } from "wagmi";
|
||||
import { base } from "wagmi/chains";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
@ -13,7 +15,7 @@ export const config = createConfig({
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export default function WagmiConfig({ children }: { children: React.ReactNode }) {
|
||||
export default function Provider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<WagmiProvider config={config}>
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
Loading…
x
Reference in New Issue
Block a user