์ข…์†์„ฑ

์ฐธ๊ณ  ์‚ฌ์ดํŠธ • ๋ฆฌ์•กํŠธ ๊ณต์‹ ๋ฌธ์„œ - useMemo ๐Ÿ“ useMemo useMemo๋Š” ์žฌ๋ Œ๋”๋ง ๊ฐ„ ๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ *์บ์‹œ(Cache)ํ•  ์ˆ˜ ์žˆ๋Š” React Hook์ด๋‹ค. ๋น„์šฉ์ด ๋งŽ์ด ๋“œ๋Š” ์žฌ๊ณ„์‚ฐ์„ ๊ฑด๋„ˆ๋›ฐ๊ธฐ ์œ„ํ•˜์—ฌ ์‚ฌ์šฉํ•œ๋‹ค. *์บ์‹œ(Cache): ์ปดํ“จํ„ฐ ๊ณผํ•™์—์„œ ๋ฐ์ดํ„ฐ๋‚˜ ๊ฐ’์„ ๋ฏธ๋ฆฌ ๋ณต์‚ฌํ•ด ๋†“๋Š” ์ž„์‹œ ์žฅ์†Œ๋กœ ๋ฐ์ดํ„ฐ ์ ‘๊ทผํ•˜๋Š” ์‹œ๊ฐ„์ด ์˜ค๋ž˜๊ฑธ๋ฆฌ๊ฑฐ๋‚˜ ๋‹ค์‹œ ๊ณ„์‚ฐํ•˜๋Š” ์‹œ๊ฐ„์„ ์ ˆ์•ฝํ•˜๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ์— ์‚ฌ์šฉ ์ถœ์ฒ˜: Wikipedia ๋ฐ˜ํ™˜๊ฐ’์„ ์บ์‹ฑํ•˜๋Š” ๊ฒƒ์„ ๋ฉ”๋ชจ์ด์ œ์ด์…˜(memoization)์ด๋ผ๊ณ ๋„ ํ•˜๋ฉฐ, ์ด๊ฒƒ์ด ์ด Hook์ด ๋ถˆ๋ฆฌ๋Š” ์ด์œ ์ด๋‹ค. ๐Ÿ“ข ์ฐธ์กฐ useMemo ์žฌ๋ Œ๋”๋ง ๊ฐ„์˜ ๊ณ„์‚ฐ์„ ์บ์‹œํ•˜๋ ค๋ฉด ๊ตฌ์„ฑ ์š”์†Œ์˜ ์ตœ์ƒ์œ„ ์ˆ˜์ค€์—์„œ ํ˜ธ์ถœํ•œ๋‹ค. const cachedValue = useMemo(calculateValue, [depende..
ma.caron_g
'์ข…์†์„ฑ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก