Skip to content

๐Ÿ’ฐ๋ถ€์ž๊ฐ€ ๋˜๊ธฐ ์œ„ํ•œ ์ฒซ๊ฑธ์Œ ์ง€์ถœ ๋‚ด์—ญ ์•ฑ with React๐Ÿ“

Notifications You must be signed in to change notification settings

yws1502/moni_money

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Moni Money

๋ฐฐํฌ URL : https://yws1502.github.io/moni_money/

๋ญ๋‹ˆ๋ญ๋‹ˆํ•ด๋„ Moni Money

์†Œ๊ฐœ ๐Ÿ™‹โ€โ™‚๏ธ

react๋ฅผ ํ™œ์šฉํ•œ ๊ฐ„๋‹จํ•œ ๊ฐ€๊ณ„๋ถ€ ์•ฑ

๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ํ†ตํ•ด ์ง€์ถœ ๋‚ด์—ญ ์ €์žฅ

ํ•ด๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•„ํ„ฐ ๊ธฐ๋Šฅ ๊ตฌํ˜„

๋ฐ์ดํ„ฐ์˜ ๊ฐ’์„ ๊ณ„์‚ฐํ•ด ์ฐจํŠธ ๊ทธ๋ž˜ํ”„ ๊ตฌํ˜„

ํšŒ๊ณ , ๋ฐฐ์šด์ 

๋ฆฌ์•กํŠธ์˜ state๊ด€๋ฆฌ์— ๋Œ€ํ•ด ๋ฐฐ์šธ ์ˆ˜ ์žˆ์—ˆ์œผ๋ฉฐ, react๋กœ ๊ตฌํ˜„์„ ํ–ˆ์ง€๋งŒ ์ฐจํ›„ next์™€ ๊ฐ™์€ SSR์„ ๊ตฌํ˜„ํ•  ๋•Œ๋ฅผ ๋Œ€๋น„ํ•ด ์‹œ๋ฉ˜ํ‹ฑํ•œ ๋งˆํฌ์—…๊ณผ ๋ฉ”ํƒ€ ํƒœ๊ทธ์˜ ์‹ ๊ฒฝ์„ ์“ฐ๋ฉด์„œ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ๋‹ค.

Moni Money๋ฅผ ๊ตฌํ˜„ํ•˜๋ฉด์„œ useState์˜ setํ•จ์ˆ˜๋Š” ๋น„๋™๊ธฐ๋กœ ์ผ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค๋Š” ์ ์„ ์ƒˆ๋กœ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.

์œ ์ €๊ฐ€ ์ƒˆ๋กœ์šด ์ง€์ถœ ๋‚ด์—ญ์„ ์ž‘์„ฑํ•œ ํ›„ ์ œ์ถœ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๋กœ์ง์„ /src/components/ExpenseForm.jsx์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ๋‹ค.

์ƒˆ๋กœ์šด ์ง€์ถœ ๋ฐ์ดํ„ฐ๊ฐ€ ์ œ์ถœ์ด ๋˜๋ฉด ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์— ๋‹ด๊ณ  /src/App.js์—์„œ ๋นผ์˜ค๋Š” ์‹์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ๋‹ค.

ํ•˜์ง€๋งŒ ์ง์ ‘์ ์œผ๋กœ refresh๋ฅผ ํ•ด์ค˜์•ผ ํ™”๋ฉด์— ๋ณด์—ฌ์ง€๊ฒŒ ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.(์ƒํƒœ๋ฅผ ์ •์˜ํ•˜์ง€ ์•Š์•„ ๋ฐ”๋€ ์ƒํƒœ๊ฐ€ ์—†์œผ๋ฏ€๋กœ ์žฌ๋ Œ๋”๋ง์„ ์•ˆํ•œ ๊ฒƒ์œผ๋กœ ์ถ”์ •). useState์˜ setํ•จ์ˆ˜๋กœ ์ƒํƒœ๋ฅผ ๋ฐ”๊พธ๋Š” ์‹์œผ๋กœ ์ƒ๊ฐ์„ ํ–ˆ์ง€๋งŒ ์ด๋ฒˆ์—๋Š” ๋‹ค๋ฅธ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

๊ฐ’์„ ๋ฐ”๊พธ๊ณ  ์ƒˆ๋กœ ๊ฐฑ์‹ ๋œ ์ƒํƒœ๋ฅผ localStorage์— ๋„ฃ์—ˆ์ง€๋งŒ localStorage์— ์ €์žฅ๋˜๋Š” ๊ฐ’์ด ์ž๊พธ ์ตœ์‹  ์ƒํƒœ๊ฐ€ ์•„๋‹Œ ์ด์ „ ์ƒํƒœ๊ฐ€ ์ €์žฅ์ด ๋˜์—ˆ๋‹ค. ๋””๋ฒ„๊น…์„ ํ•˜๋Š” ๊ณผ์ •์—์„œ setํ•จ์ˆ˜ ์•ˆ์— ์žˆ๋Š” ์นœ๊ตฌ๋“ค์€ ๋งˆ์ง€๋ง‰์— console์ด ์ฐํžŒ๋‹ค๋Š” ๊ฒƒ์„ ๋ณด๊ณ  ๊ฐ’์„ localStorage์— ๋‹ด๋Š” ์ž‘์—… ์ดํ›„์— setํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰๋˜์–ด ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ์ฒ˜๋Ÿผ ์ผ์„ ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.

๋”ฅ๋‹ค์ด๋ธŒ๋ฅผ ์ฝ์œผ๋ฉด์„œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ์ž‘๋™์›๋ฆฌ์— ๋Œ€ํ•ด ๋ฐฐ์›Œ๋‘” ๊ฒƒ์ด ํฐ ๋„์›€์ด ๋๋‹ค.

๊ฒฐ๊ณผ์ ์œผ๋กœ setํ•จ์ˆ˜ ์•ˆ์— ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค๊ณ  ์ฝœ๋ฐฑํ•จ์ˆ˜์—์„œ localStorage์— ์ €์žฅํ•˜๋Š” ๋กœ์ง์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ๋‹ค.

About

๐Ÿ’ฐ๋ถ€์ž๊ฐ€ ๋˜๊ธฐ ์œ„ํ•œ ์ฒซ๊ฑธ์Œ ์ง€์ถœ ๋‚ด์—ญ ์•ฑ with React๐Ÿ“

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published