๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

localstorage

(2)
[ LocalStorage ] localStorage์—์„œ ๋ฐฐ์—ด(Array)๋‹ค๋ฃจ๊ธฐ. ์ตœ๊ทผ ์ž‘์—… ํ•  ๋ถ€๋ถ„์ด client์ธก์—์„œ `localStorage`๋ฅผ ํ†ตํ•ด ๋ฐฐ์—ด์„ ์ €์žฅ, ์ˆ˜์ •, ์‚ญ์ œํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•ด์•ผ ํ•ด์„œ ์ •๋ฆฌํ•ด ๋ณด์•˜๋‹ค. (localStorage๋Š” ์›น ๋ธŒ๋ผ์šฐ์ €์˜ ํด๋ผ์ด์–ธํŠธ ์ธก์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์›น ์Šคํ† ๋ฆฌ์ง€) 1. ๋ฐฐ์—ด์„ `localStorage`์— ์ €์žฅํ•˜๊ธฐ: // ์˜ˆ์‹œ ๋ฐฐ์—ด const myArray = [1, 2, 3, 4, 5]; // ๋ฐฐ์—ด์„ JSON ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ localStorage์— ์ €์žฅ localStorage.setItem('myArray', JSON.stringify(myArray)); * localStorage๋Š” value์— ๋ฌธ์ž์—ด๋งŒ ๊ฐ€๋Šฅํ•˜๊ธฐ ๋•Œ๋ฌธ์—, JSON.stringufy()๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฐฐ์—ด์„ ๋ฌธ์ž๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ด์•ผํ•œ๋‹ค. 2. `localStor..
[ React / Recoil ] React์˜ ์ƒํƒœ๊ด€๋ฆฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ Recoil์˜ effects ์‚ฌ์šฉํ•˜๊ธฐ. ๋‚˜๋Š” ๋ณดํ†ต react ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด ๊ฐ„๋‹จํ•œ ์ƒํƒœ ๊ด€๋ฆฌ๋“ค์€ ๋Œ€๋ถ€๋ถ„ recoil์„ ํ†ตํ•ด ํ•˜๋Š”๋ฐ ์ด๋ฒˆ์— recoil์˜ ๋ถ€๊ฐ€์ ์ธ ๊ธฐ๋Šฅ๋“ค์— ๋Œ€ํ•ด ๋” ์„œ์น˜๋ฅผ ํ•˜๋‹ค๊ฐ€ Atom Effects์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒŒ ๋˜์—ˆ๋‹ค. Recoil ๊ณต์‹ ํŽ˜์ด์ง€์˜ Atom Effects ์„ค๋ช…์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ํ†ตํ•ด ์ฐธ๊ณ ํ•˜๋ฉด ๋œ๋‹ค. atom effects - recoil recoil ๊ณต์‹ ํŽ˜์ด์ง€์—์„œ ์†Œ๊ฐœํ•˜๋Š” atom effects๋Š” ๋ถ€์ˆ˜ํšจ๊ณผ๋“ค์„ ๊ด€๋ฆฌํ•˜๊ณ  Recoil์˜ atom์„ ์ดˆ๊ธฐํ™”ํ•˜๊ฑฐ๋‚˜ ๋™๊ธฐํ™”ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” API๋ผ๊ณ  ์„ค๋ช…ํ•œ๋‹ค. Atom Effects - ์ƒํƒœ ์ง€์†์„ฑ - ์ƒํƒœ ๋™๊ธฐํ™” - ํžˆ์Šคํ† ๋ฆฌ ๊ด€๋ฆฌ - ๋กœ๊น… ๋“ฑ์— ์œ ์šฉํ•˜๊ณ  React Effects์™€๋„ ์œ ์‚ฌํ•˜์ง€๋งŒ Atom Effects๋Š” atom์„ ์ •์˜ํ•  ๋•Œ atom ์ •์˜์˜ ์ผ๋ถ€๋กœ..