Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
woohm402 committed Sep 17, 2024
1 parent ead1177 commit a3f4381
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 212 deletions.
15 changes: 9 additions & 6 deletions frontend/lecture/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import {
ChevronLeftIcon,
ChevronRightIcon,
} from '@radix-ui/react-icons';
import { useCallback, useEffect, useState } from 'react';
import { Suspense, useCallback, useEffect, useState } from 'react';
import { Link, Route, Routes, useLocation } from 'react-router-dom';

import { ThemeToggle } from '@/components/ThemeToggle';
import { Separator } from '@/designsystem/ui/separator';
import { Skeleton } from '@/designsystem/ui/skeleton';
import { Tabs, TabsList, TabsTrigger } from '@/designsystem/ui/tabs';
import { Toaster } from '@/designsystem/ui/toaster';
import {
Expand All @@ -27,11 +28,13 @@ export const App = () => {
<Sidebar />
<Separator orientation="vertical" />
<main className="flex-1 overflow-y-scroll p-4">
<Routes>
{Object.entries(pages).map(([key, { path, element }]) => (
<Route key={key} path={path} element={element} />
))}
</Routes>
<Suspense fallback={<Skeleton className="h-full w-full" />}>
<Routes>
{Object.entries(pages).map(([key, { path, element }]) => (
<Route key={key} path={path} element={element} />
))}
</Routes>
</Suspense>
</main>
<Toaster />
</div>
Expand Down
32 changes: 29 additions & 3 deletions frontend/lecture/src/components/StackBadge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ export const StackBadge = ({
| 'CloudFront'
| 'Route 53'
| 'Azure'
| 'Google Cloud';
| 'Google Cloud'
| 'Figma'
| 'Zeplin'
| 'CSS Modules'
| 'Next.js'
| 'Vercel'
| 'Turbopack'
| 'Turborepo'
| 'Create React App'
| 'GitHub Copilot';
}) => {
const image = {
Zustand:
Expand All @@ -31,7 +40,7 @@ export const StackBadge = ({
Redux: 'https://redux.js.org/img/redux.svg',
'Tanstack Query':
'https://seeklogo.com/images/R/react-query-logo-1340EA4CE9-seeklogo.com.png',
SWR: null,
SWR: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSi42tpID7bbxVYGkhd0BNQzgf1NvcABZZ8KA&s',
Recoil:
'https://d2eip9sf3oo6c2.cloudfront.net/tags/images/000/001/298/square_480/recoil.png',
MobX: 'https://mobx.js.org/assets/mobx.png',
Expand All @@ -56,11 +65,28 @@ export const StackBadge = ({
'https://static-00.iconduck.com/assets.00/google-cloud-icon-2048x1646-7admxejz.png',
'Route 53':
'https://static-00.iconduck.com/assets.00/aws-route53-icon-212x256-16an9num.png',
Figma:
'https://upload.wikimedia.org/wikipedia/commons/a/ad/Figma-1-logo.png',
Zeplin:
'https://static-00.iconduck.com/assets.00/apps-zeplin-icon-2048x2048-qh5y1ogk.png',
'CSS Modules':
'https://raw.githubusercontent.com/css-modules/logos/master/css-modules-logo.png',
'Next.js':
'https://static-00.iconduck.com/assets.00/nextjs-icon-512x512-y563b8iq.png',
Vercel: 'https://www.svgrepo.com/show/327408/logo-vercel.svg',
Turbopack:
'https://seeklogo.com/images/T/turbopack-icon-logo-77EE129FEC-seeklogo.com.png',
Turborepo:
'https://seeklogo.com/images/T/turborepo-logo-D9CF2C830E-seeklogo.com.png',
'Create React App':
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRf8yndOQhIaFf36hkWn9w6UAff4nmPREbmvQ&s',
'GitHub Copilot':
'https://seeklogo.com/images/G/github-copilot-logo-C25AFBDF08-seeklogo.com.png',
}[stack];

return (
<span className="inline-flex items-center gap-2 rounded-md bg-slate-200 py-1 pl-2 pr-3 text-xl dark:bg-slate-700">
{image !== null && <img src={image} className="inline w-6 rounded" />}
<img src={image} className="inline w-6 rounded" />
<span>{stack}</span>
</span>
);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 94 additions & 1 deletion frontend/lecture/src/lectures/Ecosystem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { ExternalLink } from '@/components/ExternalLink';
import { InlineCode } from '@/components/InlineCode';
import { Slides } from '@/components/Slides';
import { StackBadge } from '@/components/StackBadge';
import { getLectureItem } from '@/lectures';

import nextJsUsage from './NextJS-usage.png';

export const ecosystemLecture = getLectureItem({
title: '프론트엔드 생태계',
description: '기술 동향 파악하기, 생태계에 참여하기',
Expand All @@ -14,7 +19,95 @@ export const ecosystemLecture = getLectureItem({
<div className="flex flex-col gap-4">
<p>코드에서 한발짝 벗어난 이야기들</p>
<p>프론트엔드 생태계에 대해 이해한다</p>
<p>생태계가 나아가는 방향을 파악할 수 있다</p>
<p>
생태계가 나아가는 방향을 파악하고, 앞으로 어떤 공부를 어떻게
할지 생각해볼 수 있게 된다
</p>
</div>
),
},
{
title: 'React 의 방향성',
content: (
<div className="flex flex-col gap-4">
<p>
리액트는 최근에 서버 컴포넌트를 상용화시켰고, 이제{' '}
<InlineCode code="React Compiler" />
라는 걸 준비하는 중
</p>
<p>
개인적으로는 별로 중요한지 모르겠는데.. 뭔가 프레임워크로서
특이점에 다다랐다는 느낌
</p>
<p>
직접 운영하던 <StackBadge stack="Create React App" />을 버리고
프레임워크를 권장하기 시작했음
</p>
<ExternalLink
label="같이 읽어볼 만 한 글"
href="https://junghan92.medium.com/%EB%B2%88%EC%97%AD-create-react-app-%EA%B6%8C%EC%9E%A5%EC%9D%84-vite%EB%A1%9C-%EB%8C%80%EC%B2%B4-pr-%EB%8C%80%ED%95%9C-dan-abramov%EC%9D%98-%EB%8B%B5%EB%B3%80-3050b5678ac8"
/>
</div>
),
},
{
title: '프레임워크: Next.js',
content: (
<div className="flex flex-col gap-4">
<p>
<StackBadge stack="Next.js" /> 는 현재 프론트엔드 트렌드를
이끌어가는 프레임워크
</p>
<img src={nextJsUsage} alt="Next.js 사용 현황" />
<p>
react 공식문서에서도 <StackBadge stack="Next.js" /> 를 권장하는
만큼, 앞으로 공부하다 보면 언젠가 분명히 만나게 될 기술
</p>
<p>
<StackBadge stack="Vercel" /> 은 프론트엔드 생태계에 하나의
왕국을 건설하고 있다 (<StackBadge stack="Next.js" />,{' '}
<StackBadge stack="Vercel" />, <StackBadge stack="SWR" />,{' '}
<StackBadge stack="Turbopack" />,{' '}
<StackBadge stack="Turborepo" />)
</p>
</div>
),
},
{
title: 'AI (1) copilot',
content: (
<div className="flex flex-col gap-4">
<p>
<StackBadge stack="GitHub Copilot" /> 은 코딩을 도와주는
자동완성 도구
</p>
<p>재작년쯤부터는 거의 무조건 써야 하는 필수 도구 수준</p>
<p>코파일럿이 얼마나 잘해주는지 같이 봅시다</p>
</div>
),
},
{
title: 'AI (2) cursor 등 AI 통합 IDE',
content: (
<div className="flex flex-col gap-4">
<p>
AI 통합 IDE로, IDE에게{' '}
<i>기존 코드 이거 이거 참고해서 이렇게 해줘</i> 라고 하면 다 해
준다
</p>
<p>얘도 같이 봅시다</p>
</div>
),
},
{
title: 'AI (3) v0',
content: (
<div className="flex flex-col gap-4">
<p>
<StackBadge stack="v0" /> 는 ui를 만들어주는 AI
</p>
<p>얘도 지금 같이 써볼까요?</p>
<ExternalLink href="https://v0.dev/chat" />
</div>
),
},
Expand Down
167 changes: 8 additions & 159 deletions frontend/lecture/src/lectures/Performance/index.tsx
Original file line number Diff line number Diff line change
@@ -1,167 +1,16 @@
import { Callout } from '@/components/Callout';
import { CodeSnippet } from '@/components/CodeSnippet';
import { InlineCode } from '@/components/InlineCode';
import { Slides } from '@/components/Slides';
import { lazy } from 'react';

import { getLectureItem } from '@/lectures';

import lighthouse from './lighthouse.png';
const PerformanceSlides = lazy(() =>
import('@/lectures/Performance/slides').then((r) => ({
default: r.PerformanceSlides,
})),
);

export const performanceLecture = getLectureItem({
title: '성능과 SSR',
description: 'Next.js',
date: new Date('2024-11-06 20:30:00'),
element: (
<Slides
slides={[
{
title: '이번 챕터 목표',
content: (
<div>
<ul className="flex list-disc flex-col gap-4 pl-8">
<li>프론트엔드에서 무슨 성능을 개선해야 하는지 이해한다</li>
<li>lighthouse 사용법을 익힌다</li>
<li>우리가 쓰는 CSR 방식이 왜 로딩 성능이 나쁜지 이해한다</li>
<li>SSR이란 게 있더라~ 정도를 인지한다</li>
<li>Next.js 라는 메타프레임워크의 존재를 인지한다</li>
</ul>
</div>
),
},
{
title: '성능?',
content: (
<div>
<p>보통 성능이라고 하면 떠올리는 것들</p>
<ul className="mt-6 list-disc pl-8">
<li>시간</li>
<li>공간 (메모리)</li>
<li>로딩 속도</li>
</ul>
</div>
),
},
{
title: '시간 복잡도와 렌더링 최적화 (1)',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>시간 복잡도를 줄여서 연산 시간을 줄이자!</p>
<p>하지만 웹은 대부분의 경우 n이 커봐야 1000입니다</p>
<img src="https://www.azquotes.com/picture-quotes/quote-fancy-algorithms-are-slow-when-n-is-small-and-n-is-usually-small-rob-pike-76-51-33.jpg" />
<div>
<InlineCode code="useMemo" />, <InlineCode code="memo" />
메모이제이션 기법도 있고 합성을 활용한 렌더링 최적화 기법도
있는데, 솔직히 4년동안 웹 하면서 최적화가 필요했던 적 딱 한 번
밖에 없었습니다.
</div>
<div>
리액트는 대부분의 경우 충분한 성능이 나오게 설계되었기에,
평범하게 짜면 충분히 빠릅니다.
</div>
<div>
어차피 브라우저가 60fps라서 엄청 빨라봤자 유저는 모릅니다.
</div>
</div>
),
},
{
title: '시간 복잡도와 렌더링 최적화 (2)',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>
관련해서 &quot;불필요한 리렌더를 줄여야 한다&quot; 와 같은
주장도 있는데, 딱히 공감하진 않습니다
</p>
<p>
평범하게 정상적으로 짜면 적당한 리렌더가 발생하고 유저는
불편함을 느끼지 못합니다.
</p>
<p>
불필요한 리렌더를 막으려다 필요한 리렌더를 못하거나, 코드
유지보수가 어려워지면 그게 진짜 문제입니다
</p>
<Callout title="결론">웬만하면 이거 신경쓸 필요 없다!</Callout>
</div>
),
},
{
title: '메모리',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>자바스크립트는 GC가 동작하는 언어</p>
<p>웹에서 다루는 메모리가 그리 크지 않음</p>
<p>따라서 메모리 누수가 일어나지 않는 한 별 문제 없음</p>
<Callout title="메모리 누수란?">
더 이상 필요하지 않은 메모리를 해제하지 않아서 메모리 사용량이
계속 증가하는 현상
</Callout>
<CodeSnippet
language="typescript"
code={[`const object = URL.createObjectURL(...)`]}
/>
<p>
가아아아아끔 이런 코드를 짜야 할 때가 있는데, 얘만 free 잘 해
주면 됩니다
</p>
<Callout title="결론">웬만하면 이거도 신경쓸 필요 없다!</Callout>
</div>
),
},
{
title: '로딩 속도',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>그런데 로딩 속도는 문제가 됩니다</p>
<p>
따라서 웹 개발자들은 성능을 개선할 때 로딩 속도를 최적화하는
데에 많은 노력을 쏟아야 합니다
</p>
</div>
),
},
{ title: '왜 로딩 속도는 문제가 될까?', content: <div>TBD</div> },
{
title: '로딩 속도 - lighthouse 점수',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>
로딩 속도뿐 아니라 웹 페이지의 품질을 통합적으로 체크해볼 수
있는 지표
</p>
<img src={lighthouse} />
<p>라이브로 한번 봅시다</p>
</div>
),
},
{
title: '로딩 속도 - lighthouse 실습',
content: (
<div className="flex flex-col gap-4 leading-10">
<p>
각 조별로, 만들었던 프로젝트의 lighthouse 점수를 확인하고
캡쳐해서 조별 채널에 올려주세요 (제한시간 2분)
</p>
</div>
),
},
{ title: '로딩 속도 개선: 용량 줄이기', content: <div>TBD</div> },
{ title: '로딩 속도 개선: 스켈레톤 ui', content: <div>TBD</div> },
{
title: '로딩 속도 개선: SSR (1) CSR 방식에 대한 이해',
content: <div>TBD</div>,
},
{
title: '로딩 속도 개선: SSR (2) SSR?',
content: <div>TBD</div>,
},
{
title: '로딩 속도 개선: SSR (3) 서버 컴포넌트',
content: <div>TBD</div>,
},
{
title: '로딩 속도 개선: SSR (4) 만능일까?',
content: <div>비용, 서버 리소스 관리, 프레임워크에 결합</div>,
},
]}
/>
),
element: <PerformanceSlides />,
});
Loading

0 comments on commit a3f4381

Please sign in to comment.