react-code-dataset
/
Full-Stack-Spotify-Clone-Next-13.4-React-Stripe-Supabase-Tailwind
/providers
/ModalProvider.tsx
"use client"; | |
import { useEffect, useState } from "react"; | |
import AuthModal from "@/components/AuthModal"; | |
import UploadModal from '@/components/UploadModal'; | |
import SubscribeModal from './../components/SubscribeModal'; | |
import { ProductWithPrice } from "@/types"; | |
interface ModalProviderProps { | |
products: ProductWithPrice[]; | |
} | |
const ModalProvider: React.FC<ModalProviderProps> = ({ | |
products | |
}) => { | |
const [isMounted, setIsMounted] = useState(false); | |
useEffect(() => { | |
setIsMounted(true); | |
}, []); | |
if (!isMounted) { | |
return null; | |
} | |
return ( | |
<> | |
<AuthModal /> | |
<SubscribeModal products={products} /> | |
<UploadModal /> | |
</> | |
); | |
} | |
export default ModalProvider; | |