๐Ÿ“šย Reference


๐Ÿ“œย Chapter


Error

ErrorBoundary

lazy

Front-end ์„ฑ๋Šฅ ์ตœ์ ํ™”, ๋นŒ๋“œ ์ตœ์ ํ™”

next/dynamic

Next.js

Streaming SSR

์„ฑ๋Šฅ ์ตœ์ ํ™” - React

Suspense


<Suspense fallback={<Loading />}>
  <SomeComponent />
</Suspense>
ํ•ญ๋ชฉ ๋‚ด์šฉ
์ •์˜ React์—์„œ ๋น„๋™๊ธฐ ๋ Œ๋”๋ง ์‹œ ๋กœ๋”ฉ ์ค‘ ์ƒํƒœ๋ฅผ ์„ ์–ธ์ ์œผ๋กœ ํ‘œ์‹œํ•˜๋Š” boundary
ํ•ต์‹ฌ ๊ธฐ๋Šฅ ๋ฐ์ดํ„ฐ/์ฝ”๋“œ ๋กœ๋”ฉ ์‹œ fallback UI ํ‘œ์‹œ
React 18 ์—ญํ•  Concurrent Rendering, Streaming SSR ํ•ต์‹ฌ ๊ธฐ๋Šฅ ์ค‘ ํ•˜๋‚˜
Next.js ์—ญํ•  App Router ๊ธฐ๋ณธ ๋‚ด์žฅ(loading.tsx ์ž๋™ Suspense)
์žฅ์  UX ํ–ฅ์ƒ, ๋กœ๋”ฉ ๊ด€๋ฆฌ ๋‹จ์ˆœํ™”, ์ŠคํŠธ๋ฆฌ๋ฐ ๋ Œ๋”๋ง ๊ฐ€๋Šฅ
ํ•จ๊ป˜ ์“ฐ์ด๋Š” ๊ฐœ๋… Error Boundary, Server Components, Streaming SSR

Suspense - ์›๋ฆฌ


1. React๋Š” ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ Œ๋”๋งํ•˜๋ฉด์„œ ๋น„๋™๊ธฐ ๋ฆฌ์†Œ์Šค๋ฅผ ๋งŒ๋‚จ

โ†’ ์˜ˆ: await fetch() ํ˜น์€ lazy-loaded ์ปดํฌ๋„ŒํŠธ ๋“ฑ