ํ์ฌ์์ ์ ์ฉํ๊ฒ ์ฌ์ฉํ๋ bottom-sheet๊ฐ ์์ด ์ด๋ฅผ ๋ค๋ฅธ ์ฌ๋๋ค๊ณผ๋ ๊ณต์ ํ๊ณ ์ถ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๋ง๋ค๊ฒ ๋์๋ค! ๋ํ npm์ ์ฌ๋ ค ๋ค๋ฅธ ์ฌ๋๋ค์๊ฒ ์์ค ๋ฆฌ๋ทฐ, ๋ฒ๊ทธ ๋ฑ์ ๊ณต์ ๋ฐ๊ณ ์ถ์ ๋ง์๋ ์์๋ค. ๊ธ๋ก๋ฒํ๊ฒ ์ฌ์ฉ๋์์ผ๋ฉด ํด์ ์์ด๋ก ๋ฌธ์ํํด ๋์๋ค..! + ๋ฌธ์ ์ ์ด๋ ๊ฐ์ ์ฌํญ์ issue๋ก ๋จ๊ฒจ์ฃผ์๋ฉด ์์ ํด ๋ณด๊ฒ ์ต๋๋ค ๐ช bottom-sheet ๊ด๋ จ ์์ค๋ ๊ธฐ์กด ํฌ์คํ
์์ ์์ ๊ณผ ํจ๊ป typescript๋ฅผ ์ ์ฉ์์ผฐ๋ค! @solb/bottom-sheet ์์ ์๋ฐ์คํฌ๋ฆฝํธ๋ก ๋ง๋ bottom-sheet๋ก, ๋ชจ๋ฐ์ผ ์น์ด๋ ์ฑ์์๋ bottom-sheet ํํ๋ก ๋ํ๋๊ณ ์น์์๋ ๋ชจ๋ฌ ํํ๋ก ๋ํ๋๋ค. ์์ธํ Demo๋ ์ฌ๊ธฐ์ ํ์ธํ ์ ์๋ค (๐ Demo) ์ด ์ปดํฌ๋ํธ๋ web componen..
typeScript
์ฐ๋ฆฌ๋ง์ ๋์์ธ ์์คํ
์ ๋ง๋ค๊ณ ์ถ๋ค ์๋กญ๊ฒ ์
์ ์ฌ ํ๋ก์ ํธ์ ๋ค์ด๊ฐ๋ฉฐ ๋์์ธ์์คํ
๋๋ก ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์ด ํ์ฌ ๋ด ๋ค๋ฅธ ํ๋ก์ ํธ์์๋ ์ฌ์ฉํ๊ณ ์ถ์๋ค! ์ง๊ธ๊น์ง๋ ๋์์ธ ์์คํ
์ด ์ ํด์ ธ ์๋ ๊ฒ์ด ์๋๋ผ ๊ทธ๋๊ทธ๋ ์์์ ๋ง์ถฐ์ ์์
ํด์ ์์ค๊ฐ ๋๋ฌ์ ๋ค ์ด๋ฒ ๊ธฐํ์ ์ฐ๋ฆฌ๋ง์ ๋์์ธ ์์คํ
์ ๋ง๋ค๊ณ ์ ํ๋ค ์์ฒ๋ผ ๋ฒํผ์ ๋ํ ๋์์ธ ์์คํ
์ด ์ ์๋์ด ์๋ค๋ฉด ์์, ์ฌ์ด์ฆ์ ๋ฐ๋ผ ๋ฒํผ ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค๋ฉด ๋๋ค! Button Component ๋ง๋ค๊ธฐ ์ด๋ป๊ฒ ๋ง๋ค๋ฉด ์ข์๊น์ ๋ํด์ ๊ณ ๋ฏผํ๋ฉฐ ์ฐพ์๋ณด๋ค๊ฐ velog์ ์คํ์์ค๋ฅผ ๋ดค๋๋ฐ size, color๋ฅผ ๋ฐ๋ก ์ ์ํ๊ณ props๋ก ๋ฐ๋ ๋ถ๋ถ์ด ๋๋ฌด ๊น๋ํ๊ฒ ์๋์ด ์์ด ์ด๋ฅผ ์ฐธ๊ณ ํ์ฌ ๋ง๋ค์๋ค ์ฌ์ด์ฆ ์คํ์ผ๋ง ํผ๊ทธ๋ง์ ์ ์๋ ๋๋ก ์ฌ์ด์ฆ๋ฅผ ๋๋์ด ๊ฐ๊ฐ์ ์ฌ์ด์ฆ๋ฅผ ์..
ํ์ฅ interface -extends๋ฅผ ์ฌ์ฉ type - &๋ฅผ ์ฌ์ฉ interface Student { major: string studentId: number } const mike: Student = { major: 'computer', studentId: 202212011 } type Student = { major: string studentId: number } const mike: Student = { major: 'computer', studentId: 202212011 } ์ ์ธ์ ํ์ฅ interface์์๋ ์๋ก์ด ์์ฑ์ ์ถ๊ฐํ๊ธฐ ์ํด ๊ฐ์ ์ด๋ฆ์ ์ ์ธํ ์ ์์ง๋ง, type์ ์ ์ธ์ ํ์ฅ์ด ๋ถ๊ฐ๋ฅํ๋ค. interface Student { major: string studentId: nu..
์ผ๋จ ๊ธฐ๋ณธ์ ์ผ๋ก ํ์
์ ์ถ๊ฐํด์ค์ผ ํ๋ค! ์ด๊ฑด ๋น์ฐํ๋ค! 1. import ํ ๋ ์ด๋ฏธ์ง ํ์ผ ๊ด๋ จ ์๋ฌ Cannot find modules '../..' or its corresponding type declarations. ts(2307) ๋ผ๊ณ ์๋ง์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค. ๊ทธ๋ผ ํด๊ฒฐํด ๋ณด์! srcํ์ผ ์๋์ images.d.tsํ์ผ์ ์์ฑํ๋ค. (index.d.ts๋ก ํ์ผ๋ช
์ ํ๋ฉด index.tsํ์ผ๋ก ์ธ์ํ๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ํด์ฃผ๊ธฐ) ํ์ํ ํ์ฅ์๋ฅผ ์๋์ ๊ฐ์ด ์ถ๊ฐํด์ค๋ค. declare module "*.png"; declare module "*.jpg"; tsconfig.json์ compilerOptions:{} ์์ ์ถ๊ฐํด์ค๋ค. "typeRoots": ["./src/@types"] ์ ์ฅ์..
์๋ก์ด ํ์
์คํฌ๋ฆฝํธ๋ฅผ ์ด์ฉํ ๋ฆฌ์กํธ ํ๋ก์ ํธ๋ฅผ ์์ํ๋ค. ํ์
์คํฌ๋ฆฝํธ๋ฅผ ๋ณต์ตํ ๊ฒธ ๊ธฐ์กด์ JavaScript๋ก ๋ง๋ค์๋ ํ๋ก์ ํธ๋ฅผ TypeScript๋ก ๋ณ๊ฒฝํด๋ณด๊ธฐ๋ก ํ๋ค. TypeScript๋ฅผ ์ค์นํ๋ค. yarn add typescript @types/node @types/react @types/react-dom @types/jest // ๋๋ npm install typescript @types/node @types/react @types/react-dom @types/jest ๊ทธ๋ค์ yarn install // ๋๋ npm install tsconfig.jsonํ์ผ์ด ์์ฑ๋๋ค. (ํน์ ์์ฑ๋์ง ์์๋ค๋ฉด tsconfig.json์ ์ต์๋จ์ ์ถ๊ฐํด์ค๋ค.) ์๋ ์์ค๋ฅผ tsconfig.json์ ์ถ๊ฐํด..
์ฅ์ - children, propTypes, contextTypes, defaultProps, displayName์ด ๊ธฐ๋ณธ์ ์ผ๋ก ์๋ค. ๋จ์ - children์ด ํ์ํ์ง ์๋ ๊ฒฝ์ฐ์๋ ๋ค์ด๊ฐ ์์ผ๋ฏ๋ก ํ์
์ด ๋ช
ํํ์ง ์๋ค! type FC = FunctionComponent; interface FunctionComponent { (props: PropsWithChildren, context?: any): ReactElement | null; propTypes?: WeakValidationMap | undefined; contextTypes?: ValidationMap | undefined; defaultProps?: Partial | undefined; displayName?: string | unde..