๋ฐ์ํ
- 2022 CSS Layout MasterClass
- 2.1Life Before Flexbox ~ 2.4 Rows and Columns
- React JS ๋ง์คํฐํด๋์ค
- 3.6Theme ~ 3.7 Recap
- 5.0 Setup
- ํ์
์คํฌ๋ฆฝํธ์์๋ JS ์์ฒ๋ผstyles.css๋ฅผ import ํ๋ ๋์ ์ styled.d.ts ๋ฅผ props ๋ก ํ์
์ ์ ํด์ค ๋ค์์ ์์ฑ์ ์ ๋ฌํด์ค๋ค
- @types/react-router-dom ์ฒ๋ผ ๋ฆฌ์กํธ์์ ๋ค์ด๋ฐ์์ง์ง ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋
@types
๋ฅผ ๋ถ์ฌ์npm i
ํ๋ฉด ๋๋ค. - ๋ฒ์ ๋ถ์ฌ์ ๋ค์ด๋ฐ์ ๋ 5.3.0์์ ๋งจ ๋ค์ 0์ผ ๋๋ ๋ถ์ฌ์ ๋ค์ด๋ก๋ ๋ฐ๋๊ฑฐ ์๋๋ค
- @types/react-router-dom ์ฒ๋ผ ๋ฆฌ์กํธ์์ ๋ค์ด๋ฐ์์ง์ง ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋
- flexbox ์ธ๊ณ์๋ 2๊ฐ์ง๊ฐ ์๋ค. (row, column) : ๊ธฐ๋ณธ๊ฐ์ row
→ main axis ์์ flex childern ์์น๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด justify-comtent
๋ฅผ ์ฌ์ฉํ๋ฉด ๋๋ค.
→ cross axis ์์ flex item ์์น๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด align-item
์ ์ฌ์ฉํ๋ฉด ๋๋ค.
display:flex;
flexbox์ด์ ์๋ inline-block ์ด ์์ด์ ๋๋น์ ๋์ด๊ฐ ์๋ ๊ฐ์ฒด๊ฐ ์์ผ๋ก ๋๋ํ ์์ ์ ์์์ง๋ง ์์ํ ๋น ๊ณต๊ฐ์ด ์์๋ค. ๊ทธ๋ฌ๋ ๋ฐ๋ก ๊ฐ์ฒด์ ์ ์ฉํ๋ ๊ฒ์ด ์๋๋ผ ๊ทธ ๊ฐ์ฒด(์์)์ ๋ฐ๋ก ๋ถ์ด์๋ ๋ถ๋ชจ ์์์ ์ ์ฉํ๋ ๊ฒ์ด๋ค.
ํ์ ์คํฌ๋ฆฝํธ์์ styled component ๋ฅผ ์ด์ฉํ CSS ์คํ์ผ๋ง ํ๋ ๋ฒ
- interface ๋ผ๋ object shape ๋ฅผ ๋ณ์ ํ์ ์ ์ค๋ช ํด์ค์ผ props ๋ก ์ ๋ฌ์ด ๊ฐ๋ฅํ๋ค.
- interface ๋ฅผ ์ ์ธํด์ค ๋ค์์ ์ styled component ๋ฅผ ์ ์ธํด์ฃผ๋ ํ์์ ๋ ๋ง๋ค์ด์ฃผ๊ณ , ์ Circle.tsx ๋ฅผ ๋ง๋ค์ด์ App.tsx ์ ์ ๋ฌ๋๋์ง์ ๋ํ ์๋ฆฌ๊ฐ ์ดํด๋์ง ์์๋ค
- ์ Circle.tsx ์๋ interface ๊ฐ ์๋๋ฐ, App.tsx ์๋ interface ๊ฐ ์๋๊ฑธ๊น??
- → ์ด๋ฏธ ์์ฑ๋์ด์๋ interface ๋ฅผ ๊ฐ๋ค ์ฐ๋๊ฑฐ๋ผ์?
- ๋ฌด์ธ๊ฐ ๋งํ ๋๋ ๋ ธ๋ง๋ ๋๊ธ๊ณผ ์ฌ๋์ ๋ณด๋ฉด์ ์งํํ๋ ์ต๊ด์ ๊ธฐ๋ฅด์