Skip to content

Commit

Permalink
♻️ refactor: 라우팅에서의 code splitting으로 인한 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
junyeokk committed Dec 5, 2024
1 parent 76e0c8c commit aa0d0b8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions client/src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
import { lazy, Suspense } from "react";

import ChartSkeleton from "@/components/chart/ChartSkeleton.tsx";
import ChartTab from "@/components/chart/ChartTab.tsx";
import Layout from "@/components/layout/Layout";
import MainContent from "@/components/sections/MainContent";

import { useTapStore } from "@/store/useTapStore";

const ChartTab = lazy(() => import("@/components/chart/ChartTab"));

export default function Home() {
const { tap } = useTapStore();

const renderFunction = () => {
if (tap === "main") return <MainContent />;
return (
<Suspense fallback={<ChartSkeleton />}>
<ChartTab />)
</Suspense>
);
return <ChartTab />;
};

return <Layout>{renderFunction()}</Layout>;
Expand Down

0 comments on commit aa0d0b8

Please sign in to comment.