Skip to content

Full Toolkit for Next-Level Domain Analysis

Extract providers 🏗️

Felix Wotschofskyd4d6a8995278
diff --git a/app/layout.tsx b/app/layout.tsx
index c68d8a6..e7a4a83 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,12 +1,10 @@
-'use client';
-
import type { ReactNode } from 'react';
-import { SWRConfig } from 'swr';
import Footer from '@/components/Footer';
import Header from '@/components/Header';
import './globals.css';
+import Providers from './providers';
type RootLayoutProps = {
children: ReactNode;
@@ -16,9 +14,7 @@ const RootLayout = ({ children }: RootLayoutProps) => {
return (
<html lang="en">
<body>
- <SWRConfig
- value={{ fetcher: (url) => fetch(url).then((res) => res.json()) }}
- >
+ <Providers>
<div className="flex min-h-screen flex-col items-center justify-center">
<Header />
@@ -26,7 +22,7 @@ const RootLayout = ({ children }: RootLayoutProps) => {
<Footer />
</div>
- </SWRConfig>
+ </Providers>
</body>
</html>
);
diff --git a/app/providers.tsx b/app/providers.tsx
new file mode 100644
index 0000000..db801a7
--- /dev/null
+++ b/app/providers.tsx
@@ -0,0 +1,16 @@
+'use client';
+
+import type { FC, ReactNode } from 'react';
+import { SWRConfig } from 'swr';
+
+type ProvidersProps = {
+ children: ReactNode;
+};
+
+const Providers: FC<ProvidersProps> = ({ children }) => (
+ <SWRConfig value={{ fetcher: (url) => fetch(url).then((res) => res.json()) }}>
+ {children}
+ </SWRConfig>
+);
+
+export default Providers;
diff --git a/components/Footer.tsx b/components/Footer.tsx
index 25159f0..0fd0f45 100644
--- a/components/Footer.tsx
+++ b/components/Footer.tsx
@@ -1,3 +1,5 @@
+'use client';
+
import { FaGithub, FaHeart } from 'react-icons/fa';
import { Button } from '@/components/ui/button';