55555-Jyeon / Boilerplate

personal boilerplate
0 stars 0 forks source link

[2024.01.07] router์™€ layout #3

Open 55555-Jyeon opened 10 months ago

55555-Jyeon commented 10 months ago

๐ŸŸก router์™€ layout ๊ด€๋ จ

๋กœ๊ทธ์ธ์ด ๋˜์—ˆ์„ ๋•Œ ๋ณด์—ฌ์ค„ layout๊ณผ ๋กœ๊ทธ์ธ ์ „์— ๋ณด์—ฌ์ค„ layout์ด ๋‹ฌ๋ผ์„œ ์‚ผํ•ญ์—ฐ์‚ฐ์ž ํ˜น์€ && ์—ฐ์‚ฐ์ž๋กœ ๊ตฌ์กฐ๋ฅผ ์งœ๊ณ  ์‹ถ์€๋ฐ ์ž˜ ๋˜์ง€ ์•Š์•„ ํ˜„์žฌ ์•„๋ž˜์™€ ๊ฐ™์ด ์ฒ˜๋ฆฌํ•ด๋‘ 

router
  1. isMobi ? isMobi ์ธ์ง€ ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ ํด๋ฆญ ํ›„ ์„ฑ๊ณต ์‹œ ๊ฐ’์„ true๋กœ ๋ณ€๊ฒฝ { isMobi && < SideMenubar /> } ๋ฅผ layout์— ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ layout๊ณผ outlet ์‚ฌ์ด์— props๋กœ ์ „๋‹ฌ์ด ์ž˜ ์•ˆ ๋˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค.. setIsMobi is not a function ์—๋Ÿฌ๊ฐ€ ๋–ด๋‹ค.

  2. queryString URL๋กœ๋„ ์‹œ๋„ํ–ˆ๋Š”๋ฐ ํ•œ์‹œ์ ์œผ๋กœ๋งŒ ์ ์šฉ๋œ๋‹ค. ๋ฉ”์ธ ํŽ˜์ด์ง€์—์„œ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์‚ฌ์ด๋“œ ๋ฉ”๋‰ด๋ฐ”๋ฅผ ํด๋ฆญํ–ˆ์„ ๋•Œ์—๋Š” ์ž˜ ์ ์šฉ๋˜๋Š”๋ฐ ๋‹ค์‹œ ๋กœ๊ทธ์ธํŽ˜์ด์ง€๋กœ ๋‚˜๊ฐ€์„œ ์ƒˆ๋กœ ์‹œ์ž‘ํ•˜๋ฉด ์ ์šฉ์ด ๋˜์ง€ ์•Š๋Š”๋‹ค. useEffect(( )=>{ }, [ isMobi ]) ์ด๊ฑธ๋กœ๋Š” ์•ˆ ๋˜๋Š” ๊ฑฐ ๊ฐ™์€๋ฐ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ๋– ์˜ค๋ฅด์ง€ ์•Š๋Š”๋‹ค...


signIn-form.js ์™€ layout.js ํŒŒ์ผ์—์„œ props๋กœ ์ฃผ๊ณ  ๋ฐ›๋Š” ๊ฒƒ๊ณผ ์ฟผ๋ฆฌ์ŠคํŠธ๋ง์„ ํ™œ์šฉํ•ด๋ณด๋ ค๊ณ  ์‹œ๋„ํ•ด๋ณด๋‹ค๊ฐ€ ์ผ๋‹จ ์œ„์™€ ๊ฐ™์ด ์ฒ˜๋ฆฌํ•ด๋‘๊ณ  ๊ณ„์† ์ƒ๊ฐํ•ด๋ณผ ์˜ˆ์ •

55555-Jyeon commented 9 months ago

โญ๏ธ multi-layout โญ๏ธ

๋ฉ€ํ‹ฐ ๋ ˆ์ด์•„์›ƒ์œผ๋กœ ํ•ด๋ณด๊ธฐ

multi-layout-01 multi-layout-02