ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฌธ์ œ

์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ ๋‚ด์—์„œ ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋กœ props๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๊ณผ์ •์—์„œ type ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค.

export interface InfoType {
  [key: string]: any;
  id: number;
  title: string;
  client: string;
  due: string;
  count: number;
  amount: number;
  method: string[];
  material: string[];
  status: string;
}
const InfoListForm: FC<OptionalProps> = ({ method, material, status }) => {
 
 	( ... )
 
  return (
    <Container isEmpty={isEmpty}>
      {isEmpty ? (
        <GuideLine>
          <FrontInformation>์กฐ๊ฑด์— ๋งž๋Š” ๊ฒฌ์  ์š”์ฒญ์ด ์—†์Šต๋‹ˆ๋‹ค.</FrontInformation>
        </GuideLine>
      ) : (
        currentInfoList.map((info: InfoType, index) => {
          return <CardBoard key={info.id} info={info} index={index} />;
        })
      )}
    </Container>
  );
};
'{ key: number; info: InfoType; index: number; }' ํ˜•์‹์— 'InfoType' ํ˜•์‹์˜ id, title, client, due ์™ธ 5๊ฐœ ์†์„ฑ์ด ์—†์Šต๋‹ˆ๋‹ค.
ts(2740)

 

๋ฌธ์ œํ•ด๊ฒฐ

interface InfoType ์ž์ฒด๋ฅผ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ๋ฐœ์ƒ ํ•œ ๋ฌธ์ œ์˜€๋‹ค.

 

์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด props๋กœ ๋„˜๊ฒจ์ฃผ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์Šคํ”„๋ ˆ๋“œ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ๋ณ„์ ์ธ ๊ฐ’๋“ค์˜ ๋ชฉ๋ก์œผ๋กœ ๋งŒ๋“  ๋’ค ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ ์ธ์ž ๋‚ด์—์„œ ํ•˜๋‚˜์˜ ๊ฐ์ฒด ๊ฐ’์œผ๋กœ ๋ฐ›์•„ ๋””์ŠคํŠธ๋Ÿญ์ณ๋ง ํ• ๋‹น์„ ํ†ตํ•ด ๊ฐ ๊ฐ’๋“ค์„ ์‚ฌ์šฉํ•˜์˜€๋‹ค.

const InfoListForm: FC<OptionalProps> = ({ method, material, status }) => {

	( ... )
    
  return (
    <Container isEmpty={isEmpty}>
      {isEmpty ? (
        <GuideLine>
          <FrontInformation>์กฐ๊ฑด์— ๋งž๋Š” ๊ฒฌ์  ์š”์ฒญ์ด ์—†์Šต๋‹ˆ๋‹ค.</FrontInformation>
        </GuideLine>
      ) : (
        currentInfoList.map((info: InfoType, index) => {
          return <CardBoard key={info.id} {...info} index={index} />;
        })
      )}
    </Container>
  );
};
const CardBoard: FC<InfoType> = (info: InfoType) => {
  const { title, client, due, count, amount, method, material, status, index } = info;

  ( ... )
  
};
๋Œ“๊ธ€
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
TAG
more
ยซ   2024/07   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ