[React] ๋ฆฌ์•กํŠธ๋ฅผ ํ™œ์šฉํ•œ ๋ฏธ๋‹ˆ ๋ธ”๋กœ๊ทธ

[React] ๋ฆฌ์•กํŠธ๋ฅผ ํ™œ์šฉํ•œ ๋ฏธ๋‹ˆ ๋ธ”๋กœ๊ทธ

๋ฆฌ์•กํŠธ๋ฅผ ํ™œ์šฉํ•œ ๋ฏธ๋‹ˆ ๋ธ”๋กœ๊ทธ ํ”„๋กœ์ ํŠธ์ž…๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ๋Š” list, page, ui ์ปดํฌ๋„ŒํŠธ๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ์ฃผ์š” ๊ธฐ๋Šฅ์€ ๊ธ€ ๋ชฉ๋ก ๋ณด๊ธฐ, ๊ธ€ ๋ณด๊ธฐ, ๋Œ“๊ธ€ ๋ณด๊ธฐ, ๊ธ€ ์ž‘์„ฑ, ๋Œ“๊ธ€ ์ž‘์„ฑ์ž…๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ์—์„œ๋Š” styled-components๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์Šคํƒ€์ผ๋งํ•˜๊ณ , ๋ฐ์ดํ„ฐ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋™์ ์œผ๋กœ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
Jan 03, 2024
๐Ÿ’ปHTML / CSS / JavaScriptโš›React
[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 15์žฅ ์‹ค์Šต๋ฌธ์ œ

[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 15์žฅ ์‹ค์Šต๋ฌธ์ œ

์ด ํฌ์ŠคํŠธ๋Š” React์˜ styled-components๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฒ„ํŠผ๊ณผ ๋ธ”๋ก์„ ์Šคํƒ€์ผ๋งํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•œ๋‹ค. styled-components๋Š” CSS ๋ฌธ๋ฒ•์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๋ฉด์„œ ์Šคํƒ€์ผ๋ง๋œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ์˜คํ”ˆ์†Œ์Šค ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋™์ ์œผ๋กœ ์Šคํƒ€์ผ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๊ณ , ์ปดํฌ๋„ŒํŠธ ๊ฐœ๋…์„ ํ™œ์šฉํ•˜์—ฌ ๋ฆฌ์•กํŠธ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ์šฉ์ดํ•ฉ๋‹ˆ๋‹ค.
Jan 03, 2024
โš›React
[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 14์žฅ ์‹ค์Šต๋ฌธ์ œ

[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 14์žฅ ์‹ค์Šต๋ฌธ์ œ

์ด ํฌ์ŠคํŠธ์—์„œ๋Š” ๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ ํŠธ๋ฆฌ ๋‚ด์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•˜๊ธฐ ์œ„ํ•ด ์ปจํ…์ŠคํŠธ๋ฅผ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํ•™์Šตํ–ˆ์Šต๋‹ˆ๋‹ค. ์ปจํ…์ŠคํŠธ๋ฅผ ์ด์šฉํ•˜๋ฉด ์ค‘๊ฐ„์— ์žˆ๋Š” ์—˜๋ฆฌ๋จผํŠธ๋“ค์—๊ฒŒ props๋ฅผ ๋„˜๊ฒจ์ฃผ์ง€ ์•Š๊ณ ๋„ ๋ฐ์ดํ„ฐ๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์–ด ์ฝ”๋“œ ์ตœ์ ํ™”์— ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
Jan 02, 2024
๐Ÿ’ปHTML / CSS / JavaScriptโš›React
[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 7์žฅ ์‹ค์Šต๋ฌธ์ œ

[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 7์žฅ ์‹ค์Šต๋ฌธ์ œ

์ด ๋ฌธ์„œ๋Š” ๋ฆฌ์•กํŠธ์™€ ๊ด€๋ จ๋œ ์—ฌ๋Ÿฌ ์‹ค์Šต ์˜ˆ์ œ๋“ค์„ ๋‹ค๋ฃจ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฃผ์š” ๋‚ด์šฉ์œผ๋กœ๋Š” useRef๋ฅผ ์ด์šฉํ•œ DOM ์š”์†Œ ํฌ์ปค์Šค, useEffect๋ฅผ ์ด์šฉํ•œ ์‚ฌ์ด๋“œ ์ดํŽ™ํŠธ ์ฒ˜๋ฆฌ, ์ปค์Šคํ…€ ํ›…์„ ์ด์šฉํ•œ ์ปดํฌ๋„ŒํŠธ ๊ฐœ๋ฐœ ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
Dec 30, 2023
๐Ÿ’ปHTML / CSS / JavaScriptโš›React
[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 6์žฅ ์‹ค์Šต๋ฌธ์ œ

[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 6์žฅ ์‹ค์Šต๋ฌธ์ œ

๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ์—์„œ state์™€ ์ƒ๋ช…์ฃผ๊ธฐ๋ฅผ ์ด์šฉํ•˜์—ฌ ์•Œ๋ฆผ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. NotificationList ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” state๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•Œ๋ฆผ ๋ฐ์ดํ„ฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ , componentDidMount์™€ componentWillUnmount ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์•Œ๋ฆผ์„ ์ฃผ๊ธฐ์ ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•˜๊ณ  ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์•Œ๋ฆผ์„ ๋™์ ์œผ๋กœ ํ‘œ์‹œํ•˜๊ณ  ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Dec 30, 2023
๐Ÿ’ปHTML / CSS / JavaScriptโš›React
[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 4์žฅ ์‹ค์Šต๋ฌธ์ œ

[์†Œํ”Œ์˜ ์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์•กํŠธ] 4์žฅ ์‹ค์Šต๋ฌธ์ œ

์ด ํฌ์ŠคํŠธ๋Š” ๋ฆฌ์•กํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‹œ๊ณ„ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ์‹ค์Šต ์˜ˆ์ œ์™€ ๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ๋‹ค๋ฃจ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. setInterval() ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋งค ์ดˆ๋งˆ๋‹ค clock ์ปดํฌ๋„ŒํŠธ๋ฅผ root ๋…ธ๋“œ์— ๋ Œ๋”๋งํ•˜๊ณ , ๋ Œ๋”๋ง์ด๋ž€ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ํ˜„์žฌ ์ƒํƒœ์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ UI๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ž‘์—…์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. React๋Š” Virtual DOM์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•„์š”ํ•œ ๋ถ€๋ถ„๋งŒ ์‹ค์ œ DOM์— ๋ฐ˜์˜ํ•˜์—ฌ ๋ถˆํ•„์š”ํ•œ ์ˆ˜์ •์„ ๋ฐฉ์ง€ํ•ฉ๋‹ˆ๋‹ค.
Dec 30, 2023
๐Ÿ’ปHTML / CSS / JavaScriptโš›React
[React] img elements must have an alt propโ€ฆ ์—๋Ÿฌ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

[React] img elements must have an alt propโ€ฆ ์—๋Ÿฌ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

React์—์„œ img ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ๊ผญ alt ์†์„ฑ์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์—๋Ÿฌ ๋ฉ”์‹œ์ง€์—์„œ๋Š” ์˜๋ฏธ ์žˆ๋Š” ํ…์ŠคํŠธ๋‚˜ ์žฅ์‹์šฉ ์ด๋ฏธ์ง€์˜ ๊ฒฝ์šฐ ๋นˆ ๋ฌธ์ž์—ด๋กœ ์„ค์ •ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ์„ค๋ช…ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ธฐ์กด ์ฝ”๋“œ์— alt ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Dec 29, 2023
โš›Reactโ—Error

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ปDriedPollack's Blog