"use client"; import { useState, useEffect, lazy, Suspense } from "react"; const Hero1 = lazy(() => import('../Hero1')); import Hero2 from '../Hero2' import CoursesSilder from "../CoursesSilder"; import ContactForm from '../ContactForm' import Loading from '../Loading' import Footer from '../Footer' import { CoursesProps, SettingsProps } from "@/types"; import Whatsapp from "../Whatsapp"; const Home = ({ courses, settings }: { courses: CoursesProps[], settings: SettingsProps }) => { const [loading, setLoading] = useState(true); // const [courses, setCourses] = useState([]); useEffect(() => { const loadCourses = async () => { setLoading(true); await new Promise(resolve => setTimeout(resolve, 100)); // 0.5 second delay setLoading(false); }; loadCourses(); }, []); const startLoading = () => setLoading(true); const stopLoading = () => setLoading(false); console.log(courses); return (
{loading ? (
Loading...
}>
) : (
Loading...
}>