Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kcwww authored Dec 13, 2023
1 parent cb51e83 commit c69857e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,32 @@ SSOCK νŒ€ ν”„λ‘ νŠΈμ—”λ“œμ—μ„œ μ„€κ³„ν•œ μ»΄ν¬λ„ŒνŠΈ ꡬ쑰의 κ°„λž΅ν•œ μ‹œ

크게 `Three.js` 둜 λ Œλ”λ§ν•œ Canvas μ»΄ν¬λ„ŒνŠΈμ™€ UI λ₯Ό ꡬ뢄지어 μ„€κ³„ν•˜μ˜€μŠ΅λ‹ˆλ‹€.

3D λͺ¨λΈμ„ λ Œλ”λ§ ν•˜λŠ”κ²ƒμ€ μ„±λŠ₯에 큰 영ν–₯이 μžˆμ—ˆκ³ , ν”„λ‘œμ νŠΈ κΈ°μ€€ μ• λ‹ˆλ©”μ΄μ…˜ νš¨κ³Όκ°€ 많이 λ“€μ–΄κ°€ λ¦¬λ Œλ”λ§μ„ ν•˜κ²Œ λœλ‹€λ©΄ μ• λ‹ˆλ©”μ΄μ…˜ νš¨κ³Όλ“€μ΄ μ²˜μŒλΆ€ν„° μ‹œμž‘λ˜μ–΄ (μœ„ μ†Œκ°œ GIF μ˜ˆμ‹œλ‘œ μž₯식이 λ‹€μ‹œ λ–¨μ–΄μ§€λŠ” 문제) μ‚¬μš©μž κ²½ν—˜μ— 뢀정적 영ν–₯을 쀄 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€.

λ”°λΌμ„œ λ¦¬λ Œλ”λ§μ— μ‚¬μš©λ˜λŠ” `useState` 훅을 UI λ‚΄λΆ€μ—μ„œ μ‚¬μš©ν•˜λ € μ‹œλ„ν•˜μ˜€κ³ , κ·Έλ‘œμΈν•΄ Canvas μ»΄ν¬λ„ŒνŠΈμ™€μ˜ `depth` 차이에 λŒ€ν•΄ 깊게 κ³ λ―Όν•˜κ³  μ‚¬μš©ν•˜κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ˜ν•œ κΈ°μ‘΄ React 에 기본기에 μΆ©μ‹€ν•˜κΈ° μœ„ν•΄ λ‹€λ₯Έ μƒνƒœκ΄€λ¦¬ 라이브러리λ₯Ό μ‚¬μš©ν•˜μ§€ μ•Šκ³  `useContext` 훅을 μ‚¬μš©ν•΄ μƒνƒœκ΄€λ¦¬λ₯Ό ν•˜μ˜€μŠ΅λ‹ˆλ‹€.

각 λΌμš°νŒ…λœ νŽ˜μ΄μ§€λ“€μ˜ κ³΅ν†΅μ μœΌλ‘œ μ‚¬μš©λ˜λŠ” 데이터듀을 μ •μ˜ν•΄μ£Όκ³  `Provider` 둜 ν•˜μœ„ μ»΄ν¬λ„ŒνŠΈλ“€μ„ 감싸 Canvas 와 UI λͺ¨λ‘ λ™μΌν•œ 데이터λ₯Ό μ œκ³΅ν•˜μ˜€μŠ΅λ‹ˆλ‹€.

κ·Έλ‘œμΈν•΄ Canvas둜 λ Œλ”λ§λœ μž₯식 λͺ¨λΈμ— λŒ€ν•œ 이벀트처리λ₯Ό UI μ—μ„œ μ²˜λ¦¬ν• μˆ˜ μžˆμ–΄ Canvas λ₯Ό λ¦¬λ Œλ”λ§ ν•˜μ§€ μ•Šκ³  μ •μƒμ μœΌλ‘œ 메세지λ₯Ό λ„μšΈμˆ˜ μžˆμ—ˆμŠ΅λ‹ˆλ‹€.

ν•˜μ§€λ§Œ λ°˜λŒ€μ˜ κ²½μš°λ„ κ³ λ €λ₯Ό ν•΄μ•Όν•  ν•„μš”κ°€ μƒκΈ°κ²Œ λ˜μ–΄ λ¬Έμ œκ°€ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ½μ§€μ•Šμ€ λ©”μ„Έμ§€μ˜ 경우 Canvas μ—μ„œ 3D λͺ¨λΈ ❗ 둜 λ Œλ”λ§ ν•˜μ˜€λŠ”λ°, μž₯식을 ν΄λ¦­ν•˜μ˜€μ„λ•Œ UI 와 Canvas λͺ¨λ‘ λ¦¬λ Œλ”λ§μ„ λ™μ‹œμ— ν•΄μ•Ό ν•˜λŠ” κ²½μš°κ°€ μƒκΈ°κ²Œ λ˜μ—ˆκ³ , 메세지λ₯Ό 읽을 λ•Œλ§ˆλ‹€ 3D λͺ¨λΈμ΄ λ¦¬λ Œλ”λ§ λ˜μ–΄ λ‹€μ‹œ λ–¨μ–΄μ§€κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ΄λ•Œ μ»΄ν¬λ„ŒνŠΈμ˜ `props` λ₯Ό 비ꡐ해 이전 κ°’κ³Ό κ°™μœΌλ©΄ λ¦¬λ Œλ”λ§μ„ ν•˜μ§€ μ•ŠλŠ” **`React.memo`** κ³ μ°¨ μ»΄ν¬λ„ŒνŠΈλ₯Ό μ‚¬μš©ν•˜μ—¬ ν•΄κ²°ν•˜μ˜€μŠ΅λ‹ˆλ‹€.

<br>
<div align="center">
<span><img src="https://github.com/boostcampwm2023/web11-SSOCK/assets/98443541/bdef8c62-cd15-4d2a-90c5-23eddbf66f3e" width="40%" alt="beforeReactMemo"></span>
<span><img src="https://github.com/boostcampwm2023/web11-SSOCK/assets/98443541/29ad7d51-e755-41ca-b7b9-872d56636549" width="40%" alt="afterReactMemo"></span>
</div>
<br>

[😧 useContext μƒνƒœκ΄€λ¦¬](https://delicious-halloumi-7ae.notion.site/useContext-3da416204dc24f3b879e3520241a2d45?pvs=4)

[πŸ“ React.memo λ₯Ό ν†΅ν•œ μ΅œμ ν™”](https://delicious-halloumi-7ae.notion.site/React-memo-223350a204a84227bfb100d424f5b656?pvs=4)



Expand Down

0 comments on commit c69857e

Please sign in to comment.