Skip to content

Commit

Permalink
refactor: Root 및 Toast 컴포넌트 lazy 적용 (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
shackstack committed Sep 21, 2023
1 parent aaa45b4 commit 73f02d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions frontend/src/router/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Suspense } from 'react';
import styled from 'styled-components';
import { Suspense, lazy } from 'react';
import { styled } from 'styled-components';
import { Outlet } from 'react-router-dom';
import Footer from '~/components/@common/Footer';
import { Header, MobileHeader } from '~/components/@common/Header';
import LoadingIndicator from '~/components/@common/LoadingIndicator';
import Toast from '~/components/@common/Toast';
import useMediaQuery from '~/hooks/useMediaQuery';

const Toast = lazy(() => import('~/components/@common/Toast'));

function Root() {
const { isMobile } = useMediaQuery();

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RouterProvider, createBrowserRouter } from 'react-router-dom';

import { lazy } from 'react';
import Root from './Root';

const Root = lazy(() => import('./Root'));
const MainPage = lazy(() => import('~/pages/MainPage'));
const RestaurantDetail = lazy(() => import('~/pages/RestaurantDetail'));
const SignUpPage = lazy(() => import('~/pages/SignUpPage'));
Expand Down

0 comments on commit 73f02d4

Please sign in to comment.