๋ฐ˜์‘ํ˜•

React.FC 1

[React] React.FC ์˜ ์˜๋ฏธ์™€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ด์œ 

Intro React.FC์˜ ์˜๋ฏธ์™€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ด์œ ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. type Props = { }; const TestComponent: React.FC = () => { return ( TestComponent ); }; export default TestComponent; ํ˜„์žฌ React typescript๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์—์„œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. FC๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง์•„์•ผ ํ•˜๋Š” ์ด์œ  ํ•˜์ง€๋งŒ ๐Ÿคจ React typescript๋Š” ๊ทธ๋‹ค์ง€ ์ข‹์€ ๋ฐฉ๋ฒ•์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ์ค‘์—์„œ ๊ฐ€์žฅ ํฐ ์ด์œ ๋Š” props์ด ์•”์‹œ์ ์œผ๋กœ ๋“ค์–ด๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. children์„ ์•”์‹œ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ œ๋„ค๋ฆญ์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋„ค์ž„ ์ŠคํŽ˜์ด์Šค ํŒจํ„ด์„ ์ด์šฉํ•  ๋•Œ ๋” ๋ถˆํŽธํ•ฉ..

Framework/React 2022.10.02
๋ฐ˜์‘ํ˜•