Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3์ฃผ์ฐจ ๊ธฐ๋ณธ]๐Ÿš์˜ค๋Š˜์˜ ์ ๋ฉ”์ถ”๐Ÿš #5

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

rachel5640
Copy link
Contributor

@rachel5640 rachel5640 commented Nov 11, 2023

โœจ ๊ตฌํ˜„ ๊ธฐ๋Šฅ ๋ช…์„ธ

๐ŸŒฑ ๊ธฐ๋ณธ ์กฐ๊ฑด

  • ๊ธฐ๋ณธ์กฐ๊ฑด1

โœ… ์„ ํƒ ๊ณผ์ •์€ ์ด 3๋‹จ๊ณ„์ž…๋‹ˆ๋‹ค. ( 3๊ฐœ โ†’ 3๊ฐœ โ†’ 2๊ฐœ)

โœ… ์•„์ดํ…œ์€ ์ด 18๊ฐœ ์ด์ƒ์ž…๋‹ˆ๋‹ค. (3 x 3 x 2 = 18)

์œ„๋Š” โ€œ์ตœ์†Œโ€๊ธฐ์ค€์ด๋ฉฐ ๊ทธ ์ด์ƒ์˜ ๊ฐœ์ˆ˜๋Š” ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ๊ธฐ๋ณธ์กฐ๊ฑด2

โœ… ์ „์—ญ์ƒํƒœ๊ด€๋ฆฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, context ์‚ฌ์šฉ ๊ธˆ์ง€ โŒ

โœ… Router ์‚ฌ์šฉ ๊ธˆ์ง€ โŒ


๐Ÿงฉ ๊ธฐ๋ณธ ๊ณผ์ œ

  1. ์ถ”์ฒœ ์ข…๋ฅ˜ ์„ ํƒ
    • ์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœ / ๋žœ๋ค ์ถ”์ฒœ ์ค‘ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
    • ์„ ํƒ์‹œ ๋‹ค์Œํ™”๋ฉด์œผ๋กœ ๋„˜์–ด๊ฐ‘๋‹ˆ๋‹ค.

[์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœ]

  1. ๋‹ต๋ณ€ ์„ ํƒ

    • ํ˜ธ๋ฒ„์‹œ ์Šคํƒ€์ผ ๋ณ€ํ™”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
    • ํด๋ฆญ์‹œ(์„ ํƒ์‹œ) ์Šคํƒ€์ผ ๋ณ€ํ™”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ์ด์ „์œผ๋กœ, ๋‹ค์Œ์œผ๋กœ(๊ฒฐ๊ณผ๋ณด๊ธฐ) ๋ฒ„ํŠผ

    • ์•„๋ฌด๊ฒƒ๋„ ์„ ํƒ๋˜์ง€ ์•Š์•˜์„ ์‹œ ๋ฒ„ํŠผ์„ ๋น„ํ™œ์„ฑํ™” ์‹œํ‚ต๋‹ˆ๋‹ค.

      โ†’ ๋ˆŒ๋Ÿฌ๋„ ์•„๋ฌด ๋™์ž‘ X

      โ†’ ๋น„ํ™œ์„ฑํ™”์ผ ๋•Œ ์Šคํƒ€์ผ์„ ๋‹ค๋ฅด๊ฒŒ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

    • ์ด์ „์œผ๋กœ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์ด์ „ ๋‹จ๊ณ„๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    • ๋‹ค์Œ์œผ๋กœ / ๊ฒฐ๊ณผ๋ณด๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๋‹ค์Œ ๋‹จ๊ณ„๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    • ๋ฒ„ํŠผ ํ˜ธ๋ฒ„์‹œ ์Šคํƒ€์ผ ๋ณ€ํ™”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

  3. ๊ฒฐ๊ณผ

    • ์„ ํƒํ•œ ์ •๋ณด๋“ค์— ๋งž๋Š” ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

[ ๋žœ๋ค ์ถ”์ฒœ ]

  1. ์ˆซ์ž ์นด์šดํŠธ ๋‹ค์šด
    • 3 โ†’ 2 โ†’ 1 ์ˆซ์ž ์นด์šดํŠธ ๋‹ค์šด ํ›„ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
    • ์ถ”์ฒœ ๊ฒฐ๊ณผ๋Š” ๋ฐ˜๋“œ์‹œ ๋žœ๋ค์œผ๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

[ ๊ณตํ†ต ]

  1. ๊ฒฐ๊ณผ ํ™”๋ฉด
    • ๋‹ค์‹œํ•˜๊ธฐ ๋ฒ„ํŠผ

      โ†’ ๋žœ๋ค์ถ”์ฒœ์ด๋ฉด ๋žœ๋ค ์ถ”์ฒœ start ํ™”๋ฉด์œผ๋กœ, ์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœ์ด๋ฉด ์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœ start ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค.

      โ†’ ๋ชจ๋“  ์„ ํƒ ๊ธฐ๋ก์€ ๋ฆฌ์…‹๋ฉ๋‹ˆ๋‹ค.


๐ŸŒ  ์‹ฌํ™” ๊ณผ์ œ

  1. theme + Globalstyle ์ ์šฉ

    • ์ „์—ญ์œผ๋กœ ์Šคํƒ€์ผ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ ์šฉํ•ด๋ณด์„ธ์š”
  2. ์• ๋‹ˆ๋ฉ”์ด์…˜

    • ๋žœ๋ค ์ถ”์ฒœ - ์นด์šดํŠธ๋‹ค์šด์— ํšจ๊ณผ๋ฅผ ๋„ฃ์–ด์„œ ๋” ๋‹ค์ฑ„๋กญ๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ์„ธ์š”!
  3. ํ—ค๋”

    • ์ฒ˜์Œ์œผ๋กœ ๋ฒ„ํŠผ

      โ†’ ์ถ”์ฒœ ์ข…๋ฅ˜ ์„ ํƒ ํ™”๋ฉด์ผ์‹œ ํ•ด๋‹น ๋ฒ„ํŠผ์ด ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

      โ†’ ์ฒ˜์Œ ์ถ”์ฒœ ์ข…๋ฅ˜ ์„ ํƒ ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค.

      โ†’ ๋ชจ๋“  ์„ ํƒ ๊ธฐ๋ก์€ ๋ฆฌ์…‹๋ฉ๋‹ˆ๋‹ค.

[ ์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœ ]

  1. ๋‹จ๊ณ„ ๋…ธ์ถœ

    • 3๋‹จ๊ณ„์˜ ์ง„ํ–‰ ๋‹จ๊ณ„๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
  2. ์ด์ „์œผ๋กœ ๋ฒ„ํŠผ

    • ์ด์ „์œผ๋กœ ๋Œ์•„๊ฐ€๋„ ์„ ํƒํ–ˆ๋˜ ํ•ญ๋ชฉ์ด ์„ ํƒ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • 6. useReducer , useMemo , useCallback ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ์ง ๋ฐ ์„ฑ๋Šฅ์„ ์ตœ์ ํ™”ํ•ฉ๋‹ˆ๋‹ค.


๐Ÿ’Ž PR Point

๐Ÿ“ assets

const Data = [
  {
    name: "๊ทธ ํ•ด ์šฐ๋ฆฌ๋Š”",
    category: ["romance", "domestic", "drama"],
    img: rdd,
  },
  {
    name: "๊ณ ์š”์˜ ๋ฐ”๋‹ค",
    category: ["sf", "domestic", "drama"],
    img: sdd,
  },
  {
    name: "๊ทธ๋…€์˜ ์ด๋ฆ„์€ ๋‚œ๋…ธ",
    category: ["thriller", "asia", "drama"],
    img: tad,
  },
  {
    name: "์Šค๋งˆํŠธํฐ์„ ๋–จ์–ด๋œจ๋ ธ์„ ๋ฟ์ธ๋ฐ",
    category: ["thriller", "domestic", "movie"],
    img: tdm,
  },
  {
    name: "์‚ผ์ฒด",
    category: ["sf", "asia", "drama"],
    img: sad,
  },
  {
    name: "๋ฉ”๊ฐ„",
    category: ["thriller", "oversea", "movie"],
    img: tom,
  },
  {
    name: "๋„ˆ์˜ ์ทŒ์žฅ์„ ๋จน๊ณ  ์‹ถ์–ด",
    category: ["romance", "asia", "movie"],
    img: ram,
  },
  {
    name: "๋ฐ์Šค๋…ธํŠธ",
    category: ["thriller", "asia", "movie"],
    img: tam,
  },
  {
    name: "์—๋ฐ€๋ฆฌ, ํŒŒ๋ฆฌ์— ๊ฐ€๋‹ค",
    category: ["romance", "oversea", "drama"],
    img: rod,
  },
  {
    name: "์—๋ธŒ๋ฆฌ์”ฝ ์—๋ธŒ๋ฆฌ์›จ์–ด ์˜ฌ์•ณ์›์Šค",
    category: ["sf", "asia", "movie"],
    img: sam,
  },
  {
    name: "์•„๋ฆ„๋‹ค์› ๋˜ ์šฐ๋ฆฌ์—๊ฒŒ",
    category: ["romance", "asia", "drama"],
    img: rad,
  },
  {
    name: "์Šค์œ—ํŠธํ™ˆ",
    category: ["thriller", "domestic", "drama"],
    img: tdd,
  },
  {
    name: "์Šน๋ฆฌํ˜ธ",
    category: ["sf", "domestic", "movie"],
    img: sdm,
  },
  {
    name: "๊ธฐ๋ฌ˜ํ•œ ์ด์•ผ๊ธฐ",
    category: ["thriller", "oversea", "drama"],
    img: tod,
  },
  {
    name: "๋…ธํŠธ๋ถ",
    category: ["romance", "oversea", "movie"],
    img: rom,
  },
  {
    name: "๋ธ”๋ž™๋ฏธ๋Ÿฌ",
    category: ["sf", "oversea", "drama"],
    img: sod,
  },
  {
    name: "20์„ธ๊ธฐ ์†Œ๋…€",
    category: ["romance", "domestic", "movie"],
    img: rdm,
  },
  {
    name: "์–ด๋ฉ”์ด์ง• ์ŠคํŒŒ์ด๋”๋งจ",
    category: ["sf", "oversea", "movie"],
    img: som,
  },
];

export default Data;

name, category, img ํ˜•ํƒœ๋กœ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค

๐Ÿ“ components

๋ฐ˜๋ณต์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ์ปดํฌ๋„ŒํŠธ๋“ค๊ณผ ์ „์ฒด ๊ตฌ์กฐ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ๋“ค๋กœ ์ด๋ฃจ์–ด์ ธ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“ MainSectionWrapper

  const Main = () => {
    switch (currentStep) {
      case "random":
        return <Random></Random>;
      case "prefer":
        return <Prefer></Prefer>;
      default:
        return (
          <Section>
            <Title>์›ํ•˜๋Š” ์ถ”์ฒœ๋ฐฉ์‹</Title>
            <BtnSection>
              <ChooseButton
                onClick={() => {
                  setCurrentStep("prefer");
                }}
              >
                <p>์ทจํ–ฅ๋Œ€๋กœ</p>
              </ChooseButton>
              <ChooseButton
                onClick={() => {
                  setCurrentStep("random");
                }}
              >
                <p>๋žœ๋ค์œผ๋กœ</p>
              </ChooseButton>
            </BtnSection>
          </Section>
        );
    }
  };
  return (
    <>
      <Header resetStep={resetStep}></Header>
      <MainStyle>{Main()}</MainStyle>
    </>
  );
};

๐Ÿ“ Prefer

-prefer.jsx

  const filterList = () => {
    const firstFilterList = Data.filter(
      (item) => item.category[0] === firstChoice
    );
    const secondFilterList = firstFilterList.filter(
      (item) => item.category[1] === secondChoice
    );
    const thirdFilterList = secondFilterList.filter(
      (item) => item.category[2] === thirdChoice
    );

    const finalFilterList = thirdFilterList[0];
    return finalFilterList;
  };

filter๋ฌธ์„ ํ†ตํ•ด์„œ ์„ ํƒ๋œ ์„ ํƒ์ง€๋งŒ์„ ๋‹ค์‹œ ํ•„ํ„ฐ๋งํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

  const putResult = () => {
    switch (preferStage) {

      case 1:
        return (
          <First
            setPreferStage={setPreferStage}
            firstChoice={firstChoice}
            setFirstChoice={setFirstChoice}
            setSecondChoice={setSecondChoice}
            setThirdChoice={setThirdChoice}
          />
        );


      default:
        return (
          <Section>
            <Title>์ถ”์ฒœ๋ฐฉ์‹</Title>
            <BtnSection>
              <TypeSelect>
                <p>์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœํ•ด์ค„๊ป˜</p>
              </TypeSelect>
            </BtnSection>
            <BtnWapper>
              <MoveBtn
                onClick={() => {
                  setPreferStage(1);
                }}
              >
                <p1>์‹œ์ž‘ํ•˜๊ธฐ</p1>
              </MoveBtn>
            </BtnWapper>
          </Section>
        );
    }
  };
  return <>{putResult()}</>;
};

switch case๋ฌธ์œผ๋กœ ๋‹จ๊ณ„๋ฅผ ์ฒ˜๋ฆฌํ–ˆ์–ด์š”!

๐Ÿ“ steps

๊ฐ๊ฐ์˜ ๋‹จ๊ณ„์— ํ•ด๋‹น ํ•˜๋Š” ํŽ˜์ด์ง€๋“ค๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.

  • First.jsx
  • Second.jsx
  • Third.jsx
  • result.jsx

๐Ÿ“Random

๋žœ๋ค ์ถ”์ฒจ ์„ ํƒ์‹œ ๋‚˜ํƒ€๋‚˜๋Š” ์ปดํฌ๋„ŒํŠธ์ž…๋‹ˆ๋‹ค.

  • ๐Ÿ“countdown.jsx
const CountDown = ({ setRandom }) => {
  const [time, setTime] = useState(3);

  useEffect(() => {
    time > 0 && setTimeout(() => setTime(time - 1), 1000);
  }, [time]);

  return (
    <Section>
      {time ? (
        <CountDownNumber>{time}</CountDownNumber>
      ) : (
        <RandomResult setRandom={setRandom} />
      )}
    </Section>
  );
};


export default CountDown;

์นด์šดํŠธ๋‹ค์šด ๋˜๋Š” ๋ถ€๋ถ„์œผ๋กœ useEffect ์‚ฌ์šฉํ•ด์„œ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ๐Ÿ“randomresult.jsx
const RandomResult = ({ setRandom }) => {
  const drawRandom = () => {
    return Data[Math.floor(Math.random() * Data.length)];
  };

  const randomResult = drawRandom();

  return (
    <Section>
      <Title>๊ฒฐ๊ณผ</Title>
      <ImgSection>
        <img src={randomResult.img} alt={randomResult.name} />
      </ImgSection>
      <ResultName>{randomResult.name}</ResultName>
      <BtnWapper>
        <MoveBtn
          onClick={() => {
            setRandom(false);
          }}
        >
          <p>์ฒ˜์Œ์œผ๋กœ</p>
        </MoveBtn>
      </BtnWapper>
    </Section>
  );
};


export default RandomResult;

-random.jsx

๐Ÿ“ App.jsx

const App = () => {
  return (
    <>
      <GlobalStyles />
      <section>
        <MainSectionWrapper></MainSectionWrapper>
      </section>
    </>
  );
};

export default App;

์ „์—ญ์Šคํƒ€์ผ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.


๐Ÿฅบ ์†Œ์š” ์‹œ๊ฐ„, ์–ด๋ ค์› ๋˜ ์ 

  • ์…€์ˆ˜์—†์Œ
  • react๊ฐ€ ์ฒ˜์Œ์ด๋ผ ์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ props๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ , ์„ ํƒ์ง€ ํ•„ํ„ฐ๋ง์„ ํ•ด์•ผํ•˜๋Š”์ง€ ๊ณ ๋ฏผ์„ ์ง„์งœ ๋งŽ์ด ํ•œ๊ฒƒ ๊ฐ™์•„์š”...
    ์˜ค๋ฅ˜ ๋‚˜๋Š” ๋ถ€๋ถ„๋“ค์—์„œ๋Š” OB๋ถ„๋“ค์˜ ๋„์›€์„ ๋ฐ›์•„ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค๐Ÿ˜ญ

๐ŸŒˆ ๊ตฌํ˜„ ๊ฒฐ๊ณผ๋ฌผ

๐ŸŽฌ๋ฐฐํฌ๋งํฌโค๏ธ

https://github.com/DO-SOPT-WEB/MinseoKang/assets/111034927/6c4c3095-1c60-4256-b39d-14b8e1bf2256
-> ์ถ”์ฒœ์„ ํƒ, ์ฒ˜์Œ์œผ๋กœ ์ด๋™์‹œ ๋ชจ๋“  ์„ ํƒ ์ดˆ๊ธฐํ™”, ์ด์ „์œผ๋กœ ์ด๋™์‹œ ์„ ํƒ๋˜์–ด์žˆ์Œ
https://github.com/DO-SOPT-WEB/MinseoKang/assets/111034927/1a25589e-0f69-4eb5-bc27-981a05a9c59c
-> ๋žœ๋ค์„ ํƒ

rachel5640 and others added 30 commits October 27, 2023 21:46
@rachel5640 rachel5640 changed the title [3์ฃผ์ฐจ ๊ธฐ๋ณธ]์˜ค๋Š˜์˜ ์ ๋ฉ”์ถ” [3์ฃผ์ฐจ ๊ธฐ๋ณธ]๐Ÿš์˜ค๋Š˜์˜ ์ ๋ฉ”์ถ”๐Ÿš Nov 13, 2023
Copy link

@lydiacho lydiacho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ˆ˜๊ณ  ๋„ˆ๋ฌด๋„ˆ๋ฌด ๋งŽ์•˜์–ด์š”!!!
์•„์‚ฌ๋น„์˜ ๋”ธ(?)์ด๋ผ์„œ ๊ทธ๋Ÿฐ์ง€ ์—ญ์‹œ ๋ฆฌ์•กํŠธ ์ฒ˜์Œ์ด๋ผ๊ณ  ํ•˜๋Š”๋ฐ ์กฐ๊ฑด๋ถ€๋ Œ๋”๋ง ํ•˜๋Š” ์‹ค๋ ฅ์ด ์‹ฌ์ƒ์น˜ ์•Š์€๋ฐ์š”?!?!?!? ๐Ÿซข
์‚ฌ์‹ค ๊ฐœ๋ฐœ๋™์•„๋ฆฌ์˜ ์„ธ๋ฏธ๋‚˜๋Š” ์‹œ๊ฐ„์ด ํ•œ์ •์ ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ชจ~~~๋“  ๋‚ด์šฉ์„ ๋‹ค๋ฃจ๋Š” ๊ฑด ๋ถˆ๊ฐ€๋Šฅํ•˜์ž–์•„์š”!! ๊ทธ๋ ‡๊ธฐ์— ์ฃผ์š”ํ•œ ๋‚ด์šฉ์œผ๋กœ๋Š” ๋‹ค๋ค„์ง€์ง€๋Š” ์•Š์•˜์ง€๋งŒ, ๊ด€์Šต์ ์œผ๋กœ ์ง€์ผœ์•ผํ•  ๊ทœ์น™ ๊ฐ™์€ ๊ฒƒ๋“ค์€ ์ฒ˜์Œ ๋ฐฐ์šธ ๋• ๋ชจ๋ฅด๋Š”๊ฒŒ ๋‹น์—ฐํ•œ๋ฐ์š”!
๊ทธ๋Ÿฐ ์ง€์‹์„ ์‹œ๊ฐ„์ด ์ง€๋‚จ์— ๋”ฐ๋ผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์Šต๋“์‹œ์ผœ์ฃผ๋Š” ๋ฐฉ๋ฒ•์ด ๋ฐ”๋กœ ๊ฐ™์€ ๊ณผ์ œ๋ฅผ ํ•œ ๋‹ค๋ฅธ ์นœ๊ตฌ๋“ค์˜ ์ฝ”๋“œ๋ฅผ ๋ณด๋ฉด์„œ ์˜๋ฌธ์„ ํ’ˆ๊ณ , ๋ฌผ์–ด๋ณด๊ณ , ์ƒˆ๋กœ ์•Œ์•„๊ฐ€๊ณ , ๋ฐฐ์›Œ๊ฐ€๋Š” ๊ณผ์ •์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”!!!!

๊ฒฐ๋ก ์€, ์ง€๊ธˆ ์„ธ๋ฏธ๋‚˜์—์„œ ๋ฐฐ์šด ๋‚ด์šฉ ์ ์šฉ์€ ๋„ˆ๋ฌด๋„ˆ๋ฌด ์ž˜ํ•˜๊ณ  ์žˆ๊ณ , ์กฐ๊ธˆ ๋” ์š•์‹ฌ์„ ๋‚ด์„œ ๊ฐœ๋ฐœ์„ ํ•ด๋ณด๊ณ  ์‹ถ๋‹ค๋ฉด! ๋‹ค๋ฅธ ์›จ๋น„๋“ค ์ฝ”๋“œ ์ด๋ฆฌ์ €๋ฆฌ ๊ตฌ๊ฒฝ ๋‹ค๋‹ˆ๋ฉด์„œ ์ƒ์†Œํ•œ๊ฑด ๋ฆฌ๋ทฐ ๋‹ฌ์•„์„œ ์งˆ๋ฌธํ•˜๊ฑฐ๋‚˜ ์ฐพ์•„๋ณด๋Š” ๋“ฑ ์กฐ๊ธˆ์”ฉ ์ถ”๊ฐ€๋กœ ๊ณต๋ถ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ํฐ ๋„์›€์ด ๋ ๊ฑฐ๋ผ๋Š” ๊ฟ€ํŒ์„ ๋‚จ๊ธฐ๊ณ  ๊ฐ‘๋‹ˆ๋‹น!!! (์ €๋„ ์š”์ฆ˜ ๊ทธ๋Ÿฌ๊ณ  ์žˆ๋Š”๋ฐ ๋„ˆ๋ฌด ์œ ์ตํ•ด์š” ๐Ÿ‘ )

๋„ˆ๋ฌด๋„ˆ๋ฌด ์ˆ˜๊ณ  ๋งŽ์•˜์–ด์š” โค๏ธโค๏ธโค๏ธ

P.S. PR๋ณด๊ณ  ์‚ด์ง ์ŠฌํŽ๋˜๊ฑฐ. ๋ฏผ์„œ๋ฅผ ๋„์™€์ค€ ๋‹ค๋ฅธ OB๋“ค์ด ๋ˆ„๊ตฐ์ง„ ๋ชฐ๋ผ๋„.. ๐Ÿ‘€ ๋‚˜ํ•œํ…Œ๋„ ์งˆ๋ฌธ..ํ•ด์ฃผ๋ผ.. ๋‚˜ํ•œํ…Œ๋„ ์˜์ง€.. ํ•ด์ฃผ๋ผ..

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1์ฃผ์ฐจ ์„ธ๋ฏธ๋‚˜ ๊ธฐ์–ตํ•˜๊ธฐ!! ์ด์นœ๊ตฌ ko๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š”๊ฑฐ ์žŠ์ง€๋ง™์‹œ๋‹น !

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ณดํ†ต ์ด๋ ‡๊ฒŒ ๋ถˆํ•„์š”ํ•œ ํŒŒ์ผ๋“ค์€ ์ฒ˜์Œ React ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ๊ตฌํ˜„ ์‹œ์ž‘ ์ „ ์ดˆ๊ธฐ์„ธํŒ… ์‹œ ์‹น ์ง€์›Œ์ฃผ๊ณ  ์‹œ์ž‘ํ•˜๋ฉด ์ข‹์•„์š”!!
๋‚˜์ค‘์— ์™œ ์ด ํŒŒ์ผ ์žˆ๋Š”๋ฐ ์•ˆ์ผ๋ƒ! ํ•˜๋Š” ๊ฒฝ๊ณ ๋‚˜ ์—๋Ÿฌ๊ฐ€ ๋œฐ ์ˆ˜๋„ ์žˆ๊ณ , ํŒŒ์ผ๋ช…์ด๋‚˜ ๋ชจ๋“ˆ๋ช…์ด ๊ฒน์น˜๋ฉด ๊ณจ์น˜์•„ํŒŒ์งˆ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—!

๐Ÿต ์ˆญ์ด์˜ ๋ถˆํ•„์š”ํ•œ ํŒŒ์ผ ์‚ญ์ œ

์ด๊ฑฐ ์ œ๊ฐ€ ์ด๋ฒˆ 4์ฐจ ๊ณผ์ œ ์‹œ์ž‘ํ•˜๋ฉด์„œ ์ดˆ๊ธฐ์„ธํŒ…ํ•  ๋•Œ ๋ถˆํ•„์š”ํ•œ ํŒŒ์ผ๋“ค ์‚ญ์ œํ•˜๊ณ  ๊ธฐ๋กํ•œ ์ปค๋ฐ‹์ธ๋ฐ
์ด๋Ÿฌํ•œ ํŒŒ์ผ๋“ค์„ ์‚ญ์ œํ•˜๋ฉด ๋˜๊ตฌ๋‚˜ ํ•˜๊ณ  ์ฐธ๊ณ ์šฉ์œผ๋กœ ๋ด์ฃผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์šฉ!!!

Comment on lines +9 to +11
<section>
<MainSectionWrapper></MainSectionWrapper>
</section>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒ‰์— ๋ฌถ์–ด์ฃผ๊ณ  ์žˆ๋Š” section์€ ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜์ง€๋„ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋ถˆํ•„์š”ํ•œ ์นœ๊ตฌ๊ฒ ์ฃ ?? ์ง€์›Œ์ฃผ๊ณ  ๋ฐ”๋กœ MainSectionWrapper ์ปดํฌ๋„ŒํŠธ๋ฅผ GlobalStyles ์•„๋ž˜์— ์œ„์น˜์‹œ์ผœ์ฃผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

๊ทธ๋ฆฌ๊ณ , ์ด๋ฒˆ ๊ณผ์ œ ์ฝ”๋“œ๋ฆฌ๋ทฐํ•˜๋ฉด์„œ ์›จ๋น„๋“ค์˜ ์ฝ”๋“œ์—์„œ ๋งŽ์ด ๋ฐœ๊ฒฌ๋œ ๋‚ด์šฉ์ธ๋ฐ,
<MainSectionWrapper></MainSectionWrapper>
์ด๋ ‡๊ฒŒ ๋‚ด๋ถ€ ๋‚ด์šฉ๋ฌผ์ด ๋น„์–ด์žˆ๋Š” ํƒœ๊ทธ๋Š” ์—ด๋ฆฐํƒœ๊ทธ, ๋‹ซํžŒํƒœ๊ทธ๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  <MainSectionWrapper/>์ด๋ ‡๊ฒŒ self closing ํƒœ๊ทธ๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!!
react eslint์˜ ๊ทœ์น™์—๋„ ํฌํ•จ๋˜์–ด์žˆ๋Š” ๋‚ด์šฉ์ธ๋ฐ์šฉ!!
ํ›จ์”ฌ ๋” ๋‚˜์€ ๊ฐ€๋…์„ฑ, ์ง๊ด€์„ฑ์„ ์œ„ํ•ด ์…€ํ”„ ํด๋กœ์ง• ํƒœ๊ทธ ํ˜•์‹์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ์Šต๊ด€ํ™”ํ•ด๋ด…์‹œ๋‹น ๐Ÿ

return (
<>
<Header resetStep={resetStep}></Header>
<MainStyle>{Main()}</MainStyle>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์šฐ๋ฆฌ๊ฐ€ JSX ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— element๋ฅผ ๋ฐ˜ํ™˜ํ•ด์ฃผ๋Š”๊ฑด ๋งž๋Š”๋ฐ, ์šฐ๋ฆฌ๋Š” ๊ทธ๋ ‡๊ฒŒ ํ•จ์œผ๋กœ์จ ํ•จ์ˆ˜ํ˜• ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ƒ์„ฑํ•ด์ค€๊ฑฐ์ž–์•„์šฉ!? ๋”ฐ๋ผ์„œ ์ผ๋ฐ˜์ ์ธ ํ•จ์ˆ˜ ํ˜ธ์ถœ ๋ฐฉ์‹์ด ์•„๋‹Œ, <์ปดํฌ๋„ŒํŠธ />๋ฅผ ์‚ฌ์šฉํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค!!
์กฑ,

Suggested change
<MainStyle>{Main()}</MainStyle>
<Main />

๐Ÿ“š JSX ๊ณต์‹๋ฌธ์„œ
๐Ÿ“š Components ๊ณต์‹ ๋ฌธ์„œ

Comment on lines +54 to +62
<BtnWapper>
<MoveBtn
onClick={() => {
setPreferStage(1);
}}
>
<p1>์‹œ์ž‘ํ•˜๊ธฐ</p1>
</MoveBtn>
</BtnWapper>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์˜คํƒ€ ๋ฐœ๊ฒฌ!! BtnWapper๋กœ ์ž‘์„ฑ๋˜์–ด์žˆ๋Š”๋ฐ, ์ฐพ์•„๋ณด๋‹ˆ๊นŒ ์›๋ณธ ์ปดํฌ๋„ŒํŠธ์—์„œ๋„ ํŒŒ์ผ๋ช…์€ BtnWrapper, ์ปดํฌ๋„ŒํŠธ๋ช…์€ BtnWapper๋กœ ๋˜์–ด์žˆ๋„ค์š”!! ๊ทธ๋Ÿฐ๋ฐ random.jsxํŒŒ์ผ์—์„œ๋Š” ๋˜ BtnWrapper๋ผ๊ณ  ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ  ์žˆ์–ด์š”!!! ๊ทธ๋ž˜์„œ ์•„๋งˆ ๋‘ ๊ตฐ๋ฐ ์ค‘ ํ•œ ๊ณณ์€ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ œ๋Œ€๋กœ ์ ์šฉ๋˜๊ณ  ์žˆ์ง€ ์•Š์„ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค๐Ÿค”๐Ÿค”๐Ÿค”
์ด๋Ÿฐ ์‚ฌ์†Œํ•œ ์˜คํƒ€๋Š” ๊ฐœ๋ฐœ์ž๋ฅผ ์ •๋ง ์ง€๋ˆ์ง€๋ˆํ•˜๊ฒŒ ๋งŒ๋“œ๋Š”! ์˜ค๋ฅ˜๊ฐ€ ๋‚˜๋Š”๋ฐ, ๋Œ€์ฒด ์–ด๋””๊ฐ€ ๋ฌธ์ œ์ธ์ง€ ์ฐพ์ง€ ๋ชปํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๊ณจ์นซ๊ฑฐ๋ฆฌ๊ฐ€ ๋˜๊ธฐ ์‰ฝ๊ธฐ ๋•Œ๋ฌธ์— ๊ผญ๊ณ ๊ผญ ์œ ์˜ํ•˜๊ธฐ๋กœ ํ•ด์š”!!
์˜คํƒˆ์ž ์•Œ๋ ค์ฃผ๊ฑฐ๋‚˜ ๊ณ ์ณ์ฃผ๋Š” vscode extension๋„ ์žˆ์œผ๋‹ˆ๊นŒ ์ฐพ์•„๋ณด๊ณ  ์„ค์น˜ํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋„ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹น ๐Ÿ‘

Comment on lines +107 to +123
<Section>
<Title>์ถ”์ฒœ๋ฐฉ์‹</Title>
<BtnSection>
<TypeSelect>
<p>์ทจํ–ฅ๋Œ€๋กœ ์ถ”์ฒœํ•ด์ค„๊ป˜</p>
</TypeSelect>
</BtnSection>
<BtnWapper>
<MoveBtn
onClick={() => {
setPreferStage(1);
}}
>
<p1>์‹œ์ž‘ํ•˜๊ธฐ</p1>
</MoveBtn>
</BtnWapper>
</Section>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ํƒœ๊ทธ ๊ตฌ์กฐ๊ฐ€ ๋Œ€๋ถ€๋ถ„์˜ ์ปดํฌ๋„ŒํŠธ์—์„œ ๋™์ผ/์œ ์‚ฌํ•˜๊ฒŒ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„์š”!!
๋ฏผ์„œ๊ฐ€ ์ด๋ฒˆ ๊ณผ์ œ์—์„œ ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ ๋ฐ ์žฌ์‚ฌ์šฉ์„ฑ์„ ์œ„ํ•ด ๋ฐ˜๋ณต ์‚ฌ์šฉ๋˜๋Š” ๋‹จ์œ„ ์ปดํฌ๋„ŒํŠธ๋“ค์„ ์•„์ฃผ ์ž˜ ๋ถ„๋ฆฌํ•ด์คฌ๋Š”๋ฐ์š”!
์กฐ๊ธˆ๋งŒ ๋” ๋ชจ๋“ˆํ™”๋ฅผ ํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ•์€, ์ด๋Ÿฌํ•œ ๋‹จ์œ„ ์ปดํฌ๋„ŒํŠธ๋“ค์ด ์กฐํ•ฉ๋˜๋Š” ๊ตฌ์กฐ๊ฐ€ ๋™์ผํ•˜๋‹ˆ๊นŒ ํ•˜๋‚˜ํ•˜๋‚˜ ๋ถ„๋ฆฌํ•ด์ฃผ๊ธฐ๋ณด๋‹ค ๋ฐ˜๋ณต๋˜๋Š” ๊ตฌ์กฐ ์ž์ฒด๋ฅผ ํ•˜๋‚˜์˜ ์ปดํฌ๋„ŒํŠธ๋กœ ๋ฌถ์–ด์„œ ๋ฐ˜๋ณต์‚ฌ์šฉํ•ด์ฃผ๋ฉด, ๋”์šฑ ์ถ”์ƒํ™” ์ˆ˜์ค€๊ณผ ์žฌ์‚ฌ์šฉ์„ฑ์ด ๋†’์•„์ง€๊ฒ ์ฃ ?!

์˜ˆ๋ฅผ ๋“ค์ž๋ฉด

<Section>
  <Title>...</Title>
  <BtnSection>...</BtnSection>
	<BtnWrapper>...</BtnWrapper>
</Section>

์ด๋ ‡๊ฒŒ ์ƒ๊ธด Layout ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ๋ฐ˜๋ณต๋˜๋Š” ํƒœ๊ทธ ๋‚ด๋ถ€์— ๋‹ฌ๋ผ์ง€๋Š” ๋‚ด์šฉ๋ฌผ๋“ค์€ props ๋กœ ๋„˜๊ฒจ์ฃผ๋Š”๊ฑฐ์ฃ !!
์ฒ˜์Œ๋ถ€ํ„ฐ ๊ทธ๋ ‡๊ฒŒ ๋ชจ๋“ˆํ™”ํ•˜๋Š”๊ฑฐ ์‰ฝ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฒˆ ๊ณผ์ œ์—์„œ ํ•œ๊ฒƒ์ฒ˜๋Ÿผ ํ•œ๋‹จ๊ณ„์”ฉ ๋ฐ˜๋ณต ์‚ฌ์šฉ๋˜๋Š”๊ฑธ ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ ํ•ด๊ฐ€๋ฉด์„œ ๊ฐ ์žก์œผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์šฉ ๐Ÿ’š

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ œ๊ฐ€ ์ œ์•ˆํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ชจ๋“ˆํ™” ํ•ด์ค€๋‹ค๋ฉด ํ˜„์žฌ ํŒŒ์ผ์—์„œ ๋ฌด๋ ค 12์ค„์„ ์ฐจ์ง€ํ•˜๊ณ  ์žˆ๋Š” import๋ฌธ๋“ค๋„ ํ™•! ๊ฐ„์†Œํ™”์‹œํ‚ฌ ์ˆ˜ ์žˆ๊ฒ ์ฃ ?!

<Section>
<Title>๊ฒฐ๊ณผ</Title>
<ImgSection>
<img src={randomResult.img} alt={randomResult.name} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

react๋กœ ๋„˜์–ด์˜ค๋ฉด์„œ ์‹œ๋งจํ‹ฑ ์š”์†Œ ๊นŒ๋จน๊ธฐ ์‰ฌ์šด๋ฐ img ํƒœ๊ทธ์— alt ์ฑ™๊ฒจ์ค€๊ฑฐ ๋„ˆ๋ฌด๋„ˆ๋ฌด๋„ˆ๋ฌด ๋Œ€๊ฒฌํ•˜๋‹ค !!!

return Data[Math.floor(Math.random() * Data.length)];
};

const randomResult = drawRandom();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ฐฉ๋ฒ•๋„ ์™„์ „ ์ข‹๊ณ ! ์•„๋ž˜์—์„œ randomResult.~ ๋กœ ๊ฐ ํ”„๋กœํผํ‹ฐ์— ์ ‘๊ทผํ•˜๊ณ  ์ž‡๋Š”๊ฑธ ๊ทธ๋ƒฅ ํ”„๋กœํผํ‹ฐ๋ช…์œผ๋กœ ๋ฐ”๋กœ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹น ๋ฐฉ์‹์ด ์žˆ๋‹ค๋Š” ์ ๋„ ๊ธฐ์–ตํ•˜๊ณ ์žˆ๊ธฐ!!!!

Suggested change
const randomResult = drawRandom();
const {img, name} = drawRandom();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ง€๊ธˆ ๋ฏผ์„œ๊ฐ€ First, Second, Third๋ผ๋Š” ์„ธ๊ฐœ์˜ ์ปดํฌ๋„ŒํŠธ๋กœ UI๊ตฌ์กฐ๋Š” ๋™์ผํ•˜์ง€๋งŒ ๋‚ด์šฉ๋งŒ ๋‹ฌ๋ผ์ง€๋Š” ์„ธ ๋‹จ๊ณ„๋ฅผ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋กœ ์ƒ์„ฑํ•ด์ฃผ๊ณ  ์žˆ๋Š”๋ฐ์š”! ์œ„ ์ฝ”๋ฉ˜ํŠธ์—์„œ ๋งํ–ˆ๋˜ ๊ฒƒ์ฒ˜๋Ÿผ ์ด๋ ‡๊ฒŒ ๊ตฌ์กฐ๊ฐ€ ๋ฐ˜๋ณต๋˜๋Š” ๊ฒฝ์šฐ ๊ผญ ๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ๋กœ ๋ชจ๋“ˆํ™”ํ•œ ๋’ค, ๊ฐ ๋‹จ๊ณ„๋งˆ๋‹ค ๋‹ฌ๋ผ์ง€๋Š” ๋‚ด์šฉ๋ฌผ๋“ค์€ ๋ฐฐ์—ด ๋ฐ์ดํ„ฐ ๋“ฑ์œผ๋กœ ๊ด€๋ฆฌํ•˜๋ฉด์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ปดํฌ๋„ŒํŠธ์— ๋ฐ”์ธ๋”ฉ(์ ์žฌ์ ์†Œ์— ๊ฐ’ ๋„ฃ์–ด์ฃผ๊ธฐ)ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜๋Š” ์—ฐ์Šต์„ ํ•ด๋ณด๋ฉด ์•„์ฃผ์•„์ฃผ ์„ฑ์žฅํ•  ์ˆ˜ ์ž‡์„๊ฑฐ์˜ˆ์šฉ ๐Ÿ˜Ž

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋Š” ๋‹ค ์ž˜ํ•ด์ฃผ์—ˆ๋Š”๋ฐ ์š” Random ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์— ์žˆ๋Š” ์„ธ ์ปดํฌ๋„ŒํŠธ ์นœ๊ตฌ๋“ค! ์ด๋ฆ„ ๋Œ€๋ฌธ์ž๋กœ ์‹œ์ž‘ํ•˜๋„๋ก ๋ฐ”๊ฟ”์ค์‹œ๋‹น!
์ปดํฌ๋„ŒํŠธ ๋„ค์ด๋ฐ์€ ์˜ˆ์ƒ์น˜๋ชปํ•œ ์˜ค๋ฅ˜๋ฅผ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ๊ผญ ๋Œ€๋ฌธ์ž๋กœ ์‹œ์ž‘ํ•ด์ค์‹œ๋‹น!

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-11-13 แ„‹แ…ฉแ„’แ…ฎ 6 36 28

๐Ÿ“š ๊ณต์‹ ๋ฌธ์„œ

Copy link

@se0jinYoon se0jinYoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ˆญ์ž”๋””๊ฐ€ ๋„์›€๋˜๋Š” ๋ง์„ ๋งŽ์ด ๋‚จ๊ฒจ๋‘์–ด์„œ ์ถ”๊ฐ€์ ์ธ ๋ถ€๋ถ„๋“ค๋งŒ ๋‚จ๊ฒจ๋‘์—ˆ์–ด์š” !!
์ฒซ ๋ฆฌ์•กํŠธ์ธ๋ฐ ์•ผ๋ฌด์ง€๊ฒŒ ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌํ•ด์„œ switch-case๋กœ ๋ Œ๋”๋ง ์ฒ˜๋ฆฌํ•ด์ฃผ๊ณ , prop๋„ ์ž˜ ๋ถ„๊ธฐํ•ด์„œ ๋‚ด๋ ค์ฃผ๋Š” ๋ถ€๋ถ„ ์•„์ฃผ์•„์ฃผ ์ž˜ํ–ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๋ฉด์„œ ์ฝ”๋“œ ๋ฆฌ๋ทฐ ํ–ˆ์Šต๋‹ˆ๋‹ค ! ๐Ÿฅน
์‚ด์ง์”ฉ ๋””๋ฒจ๋กญ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ถ„๋“ค์ด๋‚˜ ์ถ”ํ›„์— ๋งŽ์ด ์‚ฌ์šฉํ•˜๊ฒŒ ๋  ๋ถ€๋ถ„๋“ค ๊ด€๋ จํ•ด์„œ ๋ฆฌ๋ทฐ ๋‚จ๊ฒจ๋‘์—ˆ์œผ๋‹ˆ ๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ์–ด์š”์˜ค ๐Ÿ€
๊ณผ์ œ ํ•˜๋Š๋ผ ์ˆ˜๊ณ ํ–ˆ์–ด์š” ๐Ÿ’—๐Ÿ’—๐Ÿ’—

Comment on lines +11 to +16
const First = ({ setPreferStage, setFirstChoice, firstChoice }) => {
return (
<Section>
<QuestionWrapper>
<Question>์–ด๋–ค ์žฅ๋ฅด๋ฅผ ๋ณด๊ณ  ์‹ถ์–ด?</Question>
<Nav>1/3</Nav>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฏผ์„œ ์ฝ”๋“œ์—์„œ๋Š” first, second, third ๋กœ ๋‹จ๊ณ„๋ณ„ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋งŒ๋“ค์–ด๋‘์–ด์„œ <Nav>1/3</Nav> ์ด ๊ฐ’์ด ๋™์ ์œผ๋กœ ๋ฐ”๋€” ํ•„์š”๋Š” ์—†๊ฒ ์ง€๋งŒ!

์—ฌ๊ธฐ์„œ preferStage setterํ•จ์ˆ˜ ๋ง๊ณ ๋„ preferStage state๊ฐ’ ์ž์ฒด๋„ prop์œผ๋กœ ๋ฐ›์•„์˜ค๋ฉด
<Nav>1/3</Nav> ์ด ๋ถ€๋ถ„์„ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ฐ’์ด ์•„๋‹ˆ์–ด๋„ <Nav>{preferStage}/3</Nav> ์œผ๋กœ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๊ฒ ์ฃ  ?

Comment on lines +72 to +73
setSecondChoice={setSecondChoice}
setThirdChoice={setThirdChoice}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ง€๊ธˆ First.jsx ํŒŒ์ผ์„ ์ฐธ๊ณ ํ•ด๋ณด๋ฉด ๋‚ด๋ถ€์—์„œ ๋ฐ›์•„์˜จ Prop์„ ์‚ฌ์šฉํ•  ๋•Œ

const First = ({ setPreferStage, setFirstChoice, firstChoice }) 

๋งŒ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋‹ˆ ์ด ๋‘ ๊ฐ€์ง€๋Š” ์•ˆ ๋„˜๊ฒจ์ค˜๋„ ๋˜๊ฒ ์ฃ  ?!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ํŒŒ์ผ์€ jsx๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋‹ˆ ํ™•์žฅ์ž๋ฅผ data.js๋กœ ๋ฐ”๊ฟ”์ค์‹œ๋‹น !

Comment on lines +19 to +45
<ChooseButton
onClick={() => {
setSecondChoice("domestic");
}}
$isselected={secondChoice === "domestic"}
className={secondChoice === "domestic" ? "selected" : ""}
>
<p>๊ตญ๋‚ด</p>
</ChooseButton>
<ChooseButton
onClick={() => {
setSecondChoice("oversea");
}}
$isselected={secondChoice === "oversea"}
className={secondChoice === "oversea" ? "selected" : ""}
>
<p>ํ•ด์™ธ</p>
</ChooseButton>
<ChooseButton
onClick={() => {
setSecondChoice("asia");
}}
$isselected={secondChoice === "asia"}
className={secondChoice === "asia" ? "selected" : ""}
>
<p>์•„์‹œ์•„</p>
</ChooseButton>
Copy link

@se0jinYoon se0jinYoon Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„๋“ค์ด first๋ž‘ second ์ปดํฌ๋„ŒํŠธ์—์„œ ๋ฐ˜๋ณต๋˜์„œ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ !
์ด๋ ‡๊ฒŒ ๊ฐ™์€ ์ปดํฌ๋„ŒํŠธ์™€ ๋™์ผํ•œ ๋กœ์ง์„ ๊ฐ€์ง€๊ณ  ๋ฐ˜๋ณตํ•ด์„œ ๋ Œ๋”๋ง ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” map๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์•„์ฃผ ํŽธ๋ฆฌํ•˜๊ฒŒ ๊ตฌํ˜„ํ•ด๋ณผ ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค !

์˜ˆ๋ฅผ ๋“ค์–ด

const Second = ({ setPreferStage, setSecondChoice, secondChoice }) => {

  const CHOICE_DATA = ["domestic", "oversea", "asia"];
  const CHOICE_BTN_TEXT = ["๊ตญ๋‚ด", "ํ•ด์™ธ", "์•„์‹œ์•„"];

  return (
    ...

    <BtnSection>
        {CHOICE_DATA.map((item, idx) => {
          <ChooseButton 
            key = {idx}
            onClick = {() => {setSecondChoice(item)}}
            $isselected = {secondChoice === item}
            className = {secondChoice === item ? "selected" : ""}
          > 
            <p>{CHOICE_BTN_TEXT[idx]}</p>
          </ChooseButton>
        })}
    </BtnSection>
    
   ...

์™€ ๊ฐ™์ด ๊ตฌํ˜„ํ•ด๋ณผ ์ˆ˜ ์žˆ๊ฒ ์ฃ  ! ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์ค‘๋ณต๋œ ์ฝ”๋“œ๋ฅผ ์ค„์—ฌ์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด์š” !
๊ด€๋ จ ์•„ํ‹ฐํด ์ฒจ๋ถ€ํ•˜๊ณ  ๊ฐ‘๋‹ˆ๋‹ค ! ใ…Žใ…Ž
๋ฐ˜๋ณต๋œ ์ปดํฌ๋„ŒํŠธ map์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants