- Published on
๐ PROJECT | ๋ธ๋ก๊ทธ ์ ์ง๋ณด์ ์ผ๊ธฐ #2
Locomote the World๋ ์ ์ง๋ณด์ ์ค
๋ธ๋ก๊ทธ ํฌ์คํธ์์ ๊ณ ์ณ์ผํ ๋ถ๋ถ์ ์๋์ ๊ฐ๋ค.
- Table of Contents๊ฐ ์ค์๊ฐ์ผ๋ก ๋ด๊ฐ ์ฝ๋ ๋ถ๋ถ์ ํ์ํด์คฌ์ผ๋ฉด ์ข๊ฒ ๋ค.
- Table of Contents์์ ์ ํํ๋ฉด ํด๋น ๋ชฉ์ฐจ๋ก ๋์ด๊ฐ์ผ๋ฉด ์ข๊ฒ ๋ค.
- Comments ์น์ ์ ๋ฐ๋ก ๋ณด์์ผ๋ฉด ํจ
๋ธ๋ก๊ทธ preview๋ ํฌ๊ฒ ๋ถ๋ง์กฑ์ค๋ฌ์ด ๋ถ๋ถ์ด ์๊ณ ๊ธฐ๋ฅ๋ง ์ ๋๋ก ๊ตฌํํ๋ ๊ฒ์ ๋ชฉํ๋ก ์ผ์๋ค.
Table of Contents

๋ชจ๋ฅด๊ณ ์์๋๋ฐ ๋ธ๋ก๊ทธ์ ๊ธฐ๋ณธ ํ ํ๋ฆฟ์์ TOC๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ์ ๊ณตํ๊ณ ์์๋ค. ๊ธฐ๋ณธ์ผ๋ก ์ ๊ณต ์ํ๋ ์ค ์๊ณ ์ง์ ๋ง๋ค๊ณ ์์๋๋ฐ local์์๋ ์ ๋๊ณ ์์๋๋ฐ vercel์์ ๋ฐฐํฌํ์ ๋ ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ด์๋ค.
application error: a client-side exception has occurred (see the browser console for more information).
๋ญ์ง ์ถ์ด์ ํ๋ํ๋ ๋ค์ ๋ฃ์ด๋ดค๋๋ฐ, PostLayout์์ ์ํ๊ด๋ฆฌ๋ฅผ ํ๊ฒ ๋๋ฉด ์๊ธฐ๋ ์ค๋ฅ์ธ ๊ฒ ๊ฐ๋ค.
ํด๋น repository์์ issue๋ฅผ ๋ค์ ธ๋ดค๋๋ฐ,
I suspect swr does something to support both server-side fetch and client-side fetch which might be an issue for the layout page as the layout page only supports client-side js. A workaround might be to use swr in pages/blog/[...slug].js and pass down the information to the layout to render or just fetch on the client side.
๋น์ทํ ์ด์ ์ธ ๊ฒ ๊ฐ์๋ฐ PostLayout์์๋ client-side fetch ๋ง ๋๊ธฐ ๋๋ฌธ์, ์ํ๊ด๋ฆฌ๊ฐ ๋์ง ์์๋ ๊ฒ.
๊ทธ๋์ TOCInline.js์ ๊ตฌํํด๋จ๋ ๊ฒ๋ค๋ก ์ ๋ฆฌํ๊ณ component๋ก ๋ฐ๋ก ๋นผ์ ๋ฃ์ด๋๋๊น ๊ทธ์ ์์ผ ๋๋ ๊ฒ ๊ฐ๋ค :)
Comments
๋ฒํผ์ ์์ ๊ณ ๋ฐ๋ก useEffect๋ก ๋ฐ๋ก ํธ์ถํ๊ฒ ํ์๋ค. local์์๋ ์๋ณด์ด์ง๋ง ๋ฏธ๋ฆฌ vercel์์ ์ธํ ์ด ๋์ด์ ๋ฌธ์ ์์ด ์ ๋์๊ฐ๋คใ ใ
Wrapup & Conclusion
์ด์ ๋จ์ ๋ถ๋ถ๋ค์ ๋ธ๋ก๊ทธ ๊ตฌ๋ ์ด๋ ๋ฉ์ธ์ง ๋ณด๋ด๋ ๋ฒํผ ํ์ฑํ๋ง ๋จ์๋ค. ํ์ฌ๋ ๊ตฌ์ง์ค์ ์๋๋ผ์ ์ ์ ๊บผ๋๋ ์ํ์ด์ง๋ง.. ๊ทธ๋ฆฌ๊ณ ์ต๊ทผ ๋ฌด๋ฃ ๋ฏธ๋ ๊ฐ์ข๋ ๋ด ๋ธ๋ก๊ทธ์์ ๋ณด์ด๊ณ ์ถ์ด์ ์ด๊ฑด ์๋ง ๋ด๋ ์ฏค? ์ถํ ์นดํ ๊ณ ๋ฆฌ์ ์ถ๊ฐํ ๊ฒ ๊ฐ๋ค. Nextjs ์๋ฒ์ฌ์ด๋ ๋ ๋๋ง์ผ๋ก ์ธํ ์ค๋ฅ์์ ๊นจ๋ซ๋ ์ ์ง๋ณด์์๋ค! ๋ธ๋ก๊ทธ๋ ์ฌ๊ธฐ์ ์ ์ ๋ฉ์ถ๊ณ ๋ค๋ฅธ ํ๋ก์ ํธ๋ฅผ ์์ํ ๊ฒ ๊ฐ๋ค.
- Authors
- Name
- Amelia Young
- GitHub
- @ameliacode