Skip to content

Cwonseo/FE_react_master

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๋…ธ๋งˆ๋“œ์ฝ”๋” React JS ๋งˆ์Šคํ„ฐํด๋ž˜์Šค ๊ธฐ๋ฐ˜ ํ•™์Šต

๋ชฉ์ฐจ 1. STYLED COMPONENTS 2. TYPESCRIPT 3. REACT ROUTER V6 4. CRYPTO TRACKER 5. STATE MANAGEMENT 6. TRELLO CLONE 7. ANIMATIONS

Styled Components?

  • styled.div , styled.span ๋’ค์— ``์„ ๋ถ™์—ฌ์„œ ์“ด๋‹ค.

1. props ํ†ตํ•œ ์ปดํฌ๋„ŒํŠธ ์„ค์ •

  • Box๋ผ๋Š” ์ปดํฌ๋„ŒํŠธ ๋‚ด๋ถ€์— width: ${(props) => props.wd}์žˆ๋‹ค๋ฉด
  • ์™€ ๊ฐ™์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•จ!

2. ์ปดํฌ๋„ŒํŠธ ํ™•์žฅ extend!

  • ์ปดํฌ๋„ŒํŠธ์˜ ๋ชจ๋“  ์š”์†Œ๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ์ƒˆ๋กœ์šด ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ!
  • const Circle = styled(Box)์ถ”๊ฐ€ํ•  CSS ์š”์†Œ
  • Box ์ปดํฌ๋„ŒํŠธ ๋ฒ ์ด์Šค์— ์ถ”๊ฐ€ํ•œ ์š”์†Œ๋งŒ ์ถ”๊ฐ€๋จ.

3. asํ†ตํ•œ ํƒœ๊ทธ๋ณ€๊ฒฝ

  • ์™€ ๊ฐ™์ด ํƒœ๊ทธ๋ฅผ ๋ณ€๊ฒฝ์‹œ์ผœ ์ค„ ์ˆ˜ ์žˆ๋‹ค.

4. attrsํ†ตํ•œ ์†์„ฑ๊ฐ’ ์„ค์ •

  • ์†์„ฑ์ด ๋ฐ˜๋ณต๋˜๋Š” ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋งŒ๋“ค ๋•Œ!
  • const Input = styled.input.attrs({required:true, maxLength: 10})
  • ๋ชจ๋“  input์˜ ํƒœ๊ทธ ์†์„ฑ์— ๋“ค์–ด๊ฐ€์•ผ ํ•˜์ง€๋งŒ styled component ์ด์šฉํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

5. keyframes ์ด์šฉํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜(normal css์—์„œ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ)

  • const anim = keyframesto{}from{}
  • css ๋‚ด์— animation: ${anim} 0.5s infinite; ๋„ฃ๊ธฐ.
  • ์œ„ ์ฝ”๋“œ๋ฅผ ์ด์šฉํ•˜์—ฌ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค
  • export๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ๋„ Importํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

6. styled components๋กœ ์„ ์–ธํ•œ ์ปดํฌ๋„ŒํŠธ ๋‚ด์˜ element ์„ ํƒํ•˜๊ธฐ :pseudo selector

  • ๋ถ€๋ชจ ์š”์†Œ ๋‚ด์— ํƒœ๊ทธ๋ช…์„ ๋„ฃ์–ด ๊ทธ ์•ˆ์—์„œ๋งŒ ์ž‘๋™ํ•˜๋Š” css ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ.
  • &: hover ์„ ๋„ฃ์–ด ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • ๋งŒ์•ฝ styled component ์•ˆ์— ์žˆ๋Š” styled component๋ฅผ ์„ ํƒํ•˜๋ ค๋ฉด
  • ${Title}:hover{}์™€ ๊ฐ™์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅ

7. theme

  • ๋ชจ๋“  ์ƒ‰์ƒ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” object
  • index.js์— ์„ ์–ธํ•˜๊ณ  App์„ ๊ฐ์‹ธ ์ค€๋‹ค.
  • components์—์„œ themeProvider์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Œ.
  • ๊ทธ๋ฆฌ๊ณ  theme์„ ๋‘๊ฐœ๋ฅผ ๋งŒ๋“ค๊ณ  ๊ฐ™์€ property์ด๋ฆ„์„ ๊ฐ€์ง„๋‹ค๋ฉด ๋‹คํฌ๋ชจ๋“œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ.

Typescript?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published