Skip to content

Commit

Permalink
Merge pull request #15 from Wannabe-Woowa-Article/master-wi
Browse files Browse the repository at this point in the history
์–ด๋–ป๊ฒŒ React19๊ฐ€ (๋Œ€์ฒด๋กœ)์ธํ„ฐ๋„ท์„ ๋Š๋ฆฌ๊ฒŒ ๋งŒ๋“œ๋Š”๊ฐ€?, wait for pening - ์„œ์ŠคํŽœ์Šค ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํƒํ—˜
  • Loading branch information
llqqssttyy authored Jul 14, 2024
2 parents 934f1c8 + dd5e1cb commit f29a88e
Show file tree
Hide file tree
Showing 2 changed files with 449 additions and 0 deletions.
263 changes: 263 additions & 0 deletions July/Wait-for-pending:-A-Suspense-algorithm-exploration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
## ๐Ÿ”— [Wait for pending: A Suspense algorithm exploration](https://dev.to/alexandereardon/wait-for-pending-a-not-great-alternative-suspense-algorithm-1gdl)

### ๐Ÿ—“๏ธ ๋ฒˆ์—ญ ๋‚ ์งœ: 2024.07.08

### ๐Ÿงš ๋ฒˆ์—ญํ•œ ํฌ๋ฃจ: ๋งˆ์Šคํ„ฐ์œ„(๋ช…์žฌ์œ„)

---

Alex Reardon
Updated On Jun 25, 2024
Keyword : **React**, **Javascript**

React 19์˜ `<Suspense>` ํƒ€์ด๋ฐ์— ๋Œ€ํ•œ [ํฅ๋ฏธ๋กœ์šด ๋…ผ์˜](https://github.com/facebook/react/issues/29898)๊ฐ€ ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค.

์ด ๊ธ€์—์„œ๋Š” `<Suspense>` ๊ฒฝ๊ณ„ ๋‚ด์˜ ๋ชจ๋“  ๋Œ€๊ธฐ ์ค‘์ธ promise๊ฐ€ ํ•ด๊ฒฐ๋œ ํ›„์— ๋‹ค์‹œ ๋ Œ๋”๋ง์„ ์‹œ๋„ํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์–ด๋–ป๊ฒŒ ์ƒ๊ธธ์ง€ ํƒ๊ตฌํ•ฉ๋‹ˆ๋‹ค.

> ์ด๋Š” ์ฒ˜์Œ์—๋Š” ๋ฉ”๋ชจ์žฅ์— ์ ์–ด๋ณธ ์•„์ด๋””์–ด์—์„œ ์ถœ๋ฐœํ•ด ์ œ์•ˆ์„œ๋กœ ๋ฐœ์ „ํ–ˆ์ง€๋งŒ, ์ ‘๊ทผ ๋ฐฉ์‹์— ๋ฌธ์ œ๊ฐ€ ์žˆ์Œ์„ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ๊ธฐ๋กํ•˜๊ณ  ๊ณต์œ ํ•˜๊ธฐ๋กœ ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ๋” ๋‚˜์€ ์•„์ด๋””์–ด๊ฐ€ ๋‚˜์˜ฌ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค!
### TLDR

'Wait for pending'์€ react@18๊ณผ react@19(alpha) `<Suspense>` ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ํฅ๋ฏธ๋กœ์šด ๋ณ€ํ˜•์ž…๋‹ˆ๋‹ค. ํ‰๋ฉด ๋น„๋™๊ธฐ ํŠธ๋ฆฌ(flat async tree)์—์„œ๋Š” 'wait for pending'์ด ๋น ๋ฅธ ๋ Œ๋” ํ•จ์ˆ˜ ํ˜ธ์ถœ๊ณผ ์ตœ์†Œํ•œ์˜ ์žฌ๋ Œ๋”๋ง์„ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ค‘์ฒฉ๋œ ๋น„๋™๊ธฐ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์žˆ๋Š” ํŠธ๋ฆฌ์—์„œ๋Š” ์ž์‹ ๋น„๋™๊ธฐ ์ปดํฌ๋„ŒํŠธ์˜ ์ดˆ๊ธฐ ๋ Œ๋”๋ง์ด react@18 ์•Œ๊ณ ๋ฆฌ์ฆ˜๋ณด๋‹ค ๋Š๋ ค์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

### Background

**react@18์˜ `<Suspense>`**

- ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ๋ฅผ `<Suspense>` ๊ฒฝ๊ณ„ ๋‚ด์—์„œ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
- ์–ด๋–ค promise๊ฐ€ resolve ๋  ๋•Œ๋งˆ๋‹ค ๋ฆฌ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
- ๋” ์ด์ƒ promise๋ฅผ ๋˜์ง€๋Š” ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์—†์„ ๋•Œ๊นŒ์ง€ ๊ณ„์†ํ•ฉ๋‹ˆ๋‹ค.

๊ฒฐ๊ณผ์ ์œผ๋กœ ๋งŽ์€ ์žฌ๋ Œ๋”๋ง์ด ๋ฐœ์ƒํ•˜์ง€๋งŒ, 'fetch in render' ํ˜ธ์ถœ์˜ ๋ณ‘๋ ฌํ™”๋ฅผ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๊ณ , ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ตœ๋Œ€ํ•œ ๋นจ๋ฆฌ ๋ Œ๋”๋ง๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

**react@19 (alpha)์˜ `<Suspense>`**

- ์ปดํฌ๋„ŒํŠธ๊ฐ€ promise๋ฅผ ๋˜์งˆ ๋•Œ tree ๋ Œ๋”๋ง์„ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.
- promise๊ฐ€ resolve๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.
- tree๋ฅผ ๋ฆฌ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
- ๋” ์ด์ƒ promise๋ฅผ ๋˜์ง€๋Š” ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์—†์„ ๋•Œ๊นŒ์ง€ ๊ณ„์†ํ•ฉ๋‹ˆ๋‹ค.

์ตœ์†Œํ•œ์˜ fl๋ Œ๋”๋ง์ด ๋ฐœ์ƒํ•˜์ง€๋งŒ, 'fetch in render' ํ˜ธ์ถœ์ด ์ˆœ์ฐจ์ ์œผ๋กœ ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค(ํญํฌ์ˆ˜ ํ˜•ํƒœ(waterfall)).

### 'Wait for pending' ์•Œ๊ณ ๋ฆฌ์ฆ˜

`<Suspense>` ํƒ€์ด๋ฐ('Wait for pending')์— ๋Œ€ํ•œ ์•„์ด๋””์–ด:

- ํ˜•์ œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ํ•ญ์ƒ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.
- ๋ชจ๋“  ํ˜„์žฌ ๋˜์ ธ์ง„ promise๊ฐ€ ํ•ด๊ฒฐ๋  ๋•Œ๊นŒ์ง€ ์ž์‹ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฆฌ๋ Œ๋”๋งํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€ ๋ด…์‹œ๋‹ค!

'Wait for pending'์€ ํ˜„์žฌ์˜ react@18 `<Suspense>`์•Œ๊ณ ๋ฆฌ์ฆ˜๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ๋‹จ, ์–ด๋–ค promise๊ฐ€ resolve ๋  ๋•Œ๋งˆ๋‹ค ๋ชจ๋“  ์ž์‹์„ ๋ Œ๋”๋งํ•˜๋Š” ๋Œ€์‹ , ํ˜„์žฌ ๋˜์ ธ์ง„ ๋ชจ๋“  promise๊ฐ€ resolve๋  ๋•Œ๋งŒ ๋ Œ๋”๋งํ•ฉ๋‹ˆ๋‹ค.

- ํ˜•์ œ ๊ฐ„ 'fetch in render'๊ฐ€ ๋ณ‘๋ ฌ fetch๋ฅผ ํŠธ๋ฆฌ๊ฑฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ์—ฌ์ „ํžˆ pre-fetching์— ์ข‹์€ story๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
- ๋ฆฌ๋ Œ๋”๋ง์œผ๋กœ ์ธํ•œ ๋‚ญ๋น„๋ฅผ ์ค„์ž…๋‹ˆ๋‹ค.
- ๋น„์‹ผ ์ปดํฌ๋„ŒํŠธ ๋ Œ๋”๋ง์ด `throw`ํ•˜๋Š” ํ˜•์ œ๋“ค๊ณผ ํ•จ๊ป˜ ๋ฐœ์ƒํ•ด๋„ ์—ฌ์ „ํžˆ ์ค‘๋ณต๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ ์–ด๋„ ์ด๋Ÿฌํ•œ ์ค‘๋ณต ๋ Œ๋”๋ง์ด ์ค„์–ด๋“ญ๋‹ˆ๋‹ค.
- ๐Ÿ‘Ž ์ค‘์ฒฉ๋œ 'fetch in render' ํ˜ธ์ถœ์„ ๋Š๋ฆฌ๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (์•„๋ž˜ ์ฐธ์กฐ).

๋Œ€๋žต์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜

1. ์ž์‹๋“ค์„ ๋ Œ๋”ํ•œ๋‹ค.
2. ๋˜์ ธ์ง„ promise๊ฐ€ ์—†์œผ๋ฉด ์™„๋ฃŒ - ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด 3๋‹จ๊ณ„๋กœ ์ด๋™ํ•œ๋‹ค.
3. ๋ชจ๋“  promise resolve ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฐ๋‹ค.
4. 1๋‹จ๊ณ„๋กœ ๋Œ์•„๊ฐ„๋‹ค.

### Example 1: Only siblings

```jsx
<Suspense fallback={'loading'}>
<A />
<B />
<Suspense>
```

ํ•ด๋‹น ์˜ˆ์‹œ์—์„œ, `A`์™€ `B` ๋‘˜๋‹ค ๊ทธ๋“ค์˜ ๋ Œ๋”์— ๋ฐ์ดํ„ฐ๋ฅผ ์œ„ํ•œ `fetch`๊ฐ€ ์žˆ๋‹ค.

**react@18**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- `B` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง

Render 2

- `A`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง

Render 3

- `B`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

**react@19 alpha timing**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง

Render 2

- `A`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง

Render 3

- `B`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

๐Ÿ˜ข ๋ Œ๋”๋ง์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋ฉด(promise๋ฅผ ๋˜์ง€๋ฉด) ํญํฌ์ˆ˜(waterfall)๊ฐ€ ๋ฐœ์ƒํ•จ
๐Ÿ˜Š ์ž ์žฌ์ ์œผ๋กœ ๋น„์šฉ์ด ๋งŽ์ด ๋“œ๋Š” ์ปดํฌ๋„ŒํŠธ์˜ ๊ณผ๋„ํ•œ ๋ฆฌ๋ Œ๋”๋ง์„ ๋ฐฉ์ง€ํ•จ

**Wait for pending**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- `B` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- **`A`์™€ `B`๊ฐ€ resolve ๋˜๊ธธ ๊ธฐ๋‹ค๋ฆผ**

Render 2

- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

โœ… ์ด ๊ฒฝ์šฐ, ์ œ์•ˆ๋œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ํ›Œ๋ฅญํ•œ ๊ฒฐ๊ณผ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค!

### Example 2: children๊ณผ ํ•จ๊ป˜์ผ ๋•Œ

์—ฌ๊ธฐ์„œ 'wait for pending' ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ๋ถ€๋‹ด์„ ๋Š๋ผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

์ด์ œ `A`๊ฐ€ `ChildX`์™€ `ChildY`๋ฅผ ์ž์‹์œผ๋กœ ๋ Œ๋”๋งํ•˜๋Š”๋ฐ, ์ด๋“ค ๋˜ํ•œ 'fetch in render'๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

```jsx
<Suspense fallback={'loading'}>
<A>
<ChildX />
<ChildY />
</A>
<B />
<Suspense>

```

**react@18**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- `B` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง

Render 2

- `A`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง

Render 3

- `ChildX`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง

Render 4

- `ChildY`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง

Render 5

- `B`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

โœ… ChildX์™€ ChildY๊ฐ€ ๊ฐ€๋Šฅํ•œ ๋นจ๋ฆฌ ๋ Œ๋”๋ง๋ฉ๋‹ˆ๋‹ค.
๐Ÿ˜ข ๋งŽ์€ ์ค‘๋ณต ์žฌ๋ Œ๋”๋ง์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

**react@19 alpha timing**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง

Render 2

- `A`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, `B`๊ฐ€ promise ๋˜์ง

Render 3

- `ChildX`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, `ChildY`๊ฐ€ promise ๋˜์ง

Render 4

- `ChildY`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, `B`๊ฐ€ promise ๋˜์ง

Render 5

- `B`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

**์ œ์•ˆํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜**

Render 1

- `A` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- `B` ๋ Œ๋”๋˜์ง€๋งŒ, promise ๋˜์ง
- **`A`์™€ `B`๊ฐ€ resolve ๋˜๊ธธ ๊ธฐ๋‹ค๋ฆผ**

Render 2

- `A`์™€ `B`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋˜์ง€๋งŒ, promise ๋˜์ง
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ
- **`ChildX`์™€ `ChildY`๊ฐ€ resolve ๋˜๊ธธ ๊ธฐ๋‹ค๋ฆผ**

Render 3

- `ChildX`์™€ `ChildY`์˜ promise๊ฐ€ resolve๋จ
- `A`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildX`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `ChildY`๊ฐ€ ๋ Œ๋”๋ง๋จ
- `B`๊ฐ€ ๋ Œ๋”๋ง๋จ

โœ… react@18 ์•Œ๊ณ ๋ฆฌ์ฆ˜๋ณด๋‹ค ์ค‘๋ณต ๋ Œ๋”๋ง์ด ํ›จ์”ฌ ์ ์Šต๋‹ˆ๋‹ค.
๐Ÿ‘Ž ChildX์™€ ChildY๋Š” B๊ฐ€ ํ•ด๊ฒฐ๋˜๊ธฐ ์ „๊นŒ์ง€ 'fetch in render' ํ˜ธ์ถœ์„ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ด๋“ค์€ ๋ถ€๋ชจ์˜ ๊ฐ€์žฅ ๋Š๋ฆฐ ํ˜•์ œ๊ฐ€ ํ•ด๊ฒฐ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ค์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.
๐Ÿค” react@19 ์•Œ๊ณ ๋ฆฌ์ฆ˜๋ณด๋‹ค ๋ณ‘๋ ฌ ์ฒ˜๋ฆฌ๊ฐ€ ๋” ๋งŽ์ด ๋˜์ง€๋งŒ, react@18๋ณด๋‹ค ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์˜ ์ดˆ๊ธฐ ๋ Œ๋”๋ง ์‹œ์ž‘์ด ๋” ๋Š๋ฆฝ๋‹ˆ๋‹ค.

### ๋งˆ๋ฌด๋ฆฌ ์ƒ๊ฐ

'Wait for pending'์€ ํฅ๋ฏธ๋กœ์šด ์ ‘๊ทผ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

flat async trees์—์„œ๋Š” 'wait for pending'์ด ๋ Œ๋” ํ•จ์ˆ˜ ํ˜ธ์ถœ์„ ๋น ๋ฅด๊ฒŒ ํ•˜๊ณ  ๋ฆฌ๋ Œ๋”๋ง์„ ์ตœ์†Œํ™”ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ค‘์ฒฉ๋œ ๋น„๋™๊ธฐ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์žˆ๋Š” ํŠธ๋ฆฌ์—์„œ๋Š” ์ž์‹ ๋น„๋™๊ธฐ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ดˆ๊ธฐ ๋ Œ๋”๋ง์„ ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ๋ถ€๋ชจ ํ˜•์ œ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ Œ๋”๋ง์„ ์™„๋ฃŒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ค‘์ฒฉ๋œ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋„คํŠธ์›Œํฌ ํ˜ธ์ถœ๊ณผ ๊ฐ™์€ ๋น„์šฉ์ด ๋งŽ์ด ๋“œ๋Š” ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒฝ์šฐ, ๊ฐ€๋Šฅํ•œ ํ•œ ๋นจ๋ฆฌ ์ดˆ๊ธฐ ๋ Œ๋”๋ง์„ ํŠธ๋ฆฌ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด ์ด์ƒ์ ์ž…๋‹ˆ๋‹ค(react@18 ์•Œ๊ณ ๋ฆฌ์ฆ˜). 'Wait for pending'์€ react@19 ์ ‘๊ทผ ๋ฐฉ์‹๊ณผ ์œ ์‚ฌํ•˜์ง€๋งŒ, ๊ฐ ๋ ˆ๋ฒจ์ด ๋ณ‘๋ ฌ ์ฒ˜๋ฆฌ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋ฅธ `<Suspense>` ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์–ด๋–ป๊ฒŒ ์ƒ๊ธธ์ง€ ์ƒ๊ฐํ•ด๋ณด๋Š” ๊ฒƒ์€ ํฅ๋ฏธ๋กœ์› ์Šต๋‹ˆ๋‹ค! ์—ฌ๊ธฐ๊นŒ์ง€ ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ˜….

Cheers
Loading

0 comments on commit f29a88e

Please sign in to comment.