Hydration์ ์๋ถ ๊ณต๊ธ์ด๋ผ๋ ๋ป์ ๊ฐ์ง ์์ด ๋จ์ด์ด๋ค. ํ์ง๋ง ๊ฐ๋ฐ ์ธ์ด์ Hydration์ ์ด๋ป๊ฒ ๋ค๋ฅธ์ง ์์๋ณด์.
๋์ ์ธ ํ์ด์ง๋ฅผ ๊ตฌํํ์ง๋ ๋ชปํ๋ค
๋ ๊ฒ์
๋๋ค.๋ฐ์น ๋ง๋ฅธ ํํ
๋ก ์กด์ฌํ๊ฒ ๋ฉ๋๋ค.์๋ถ ๊ณต๊ธ
์ ํด์ฃผ๋ ๊ฒ์ Hydration์ด๋ผ๊ณ ํฉ๋๋ค.Hydrate๋ DOM tree์ ํด๋น๋๋ DOM ์์๋ฅผ ์ฐพ์ ์๋ฐ์คํฌ๋ฆฝํธ ์์ฑ(์ด๋ฒคํธ ๋ฆฌ์ค๋ ๋ฑ)๋ค์ ๋ถ์ฐฉํ๋ ์ผ์ ๋งํฉ๋๋ค.
์ด๊ธฐ ๋ก๋ฉ์๋ ๊ฐ์
๊ฒ์์์ง ์ต์ ํ
<Box
sx={{
width: '100vw',
borderBottom: '1px solid black',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Tabs
value={value}
onChange={handleChange}
textColor="primary"
indicatorColor="none"
sx={{
'& button:active': { backgroundColor: 'black' },
'& button.Mui-selected': {
backgroundColor: 'black',
color: '#dcfc73',
border: '1px solid white',
},
width: '59.16vw',
}}
>
<Tab
value={0}
label="๊ฐ์ ๋ชฉ๋ก"
sx={{
width: '100%',
maxWidth: '50%',
borderLeft: '1px solid black',
}}
/>
<Tab
value={1}
label="์ค์๊ฐ ์์
"
sx={{
width: '100%',
maxWidth: '50%',
borderRight: '1px solid black',
}}
/>
</Tabs>
</Box>
<Box sx={{ padding: 2, width: '59.16vw' }}>
{value === 0 && (
<Typography>
<StudyList studyList={studyData.lecture} />
</Typography>
)}
{value === 1 && <Typography>The second tab</Typography>}
</Box>
const StudyList = (studyList: StudyListType) => {
const list = studyList.studyList;
return (
<>
{Object.entries(list).map(([week, data]) => (
<div key={week}>
<div key={week}>{week}</div>
{Object.entries(data).map(([lecture, info]) => (
<div key={lecture}>
<Accordion>
<AccordionSummary
expandIcon={<ArrowDropDownIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography>
{lecture} {info.title}
</Typography>
</AccordionSummary>
<AccordionDetails>์ ํ๋ถ ์์</AccordionDetails>
</Accordion>
</div>
))}
</div>
))}
</>
);
};
<Box sx={{ padding: 2, width: '59.16vw' }}>
{value === 0 && (
<Typography>
<StudyList studyList={studyData.lecture} />
</Typography>
)}
{value === 1 && <Typography>The second tab</Typography>}
</Box>
<Typography>
<StudyList studyList={studyData.lecture} />
</Typography>
<p>ํ๊ทธ ์์ <div> ํ๊ทธ
๊ฐ ์๋ ํํ์๊ธฐ ๋๋ฌธ์ด์๋ค.ํ๊ทธ ์์
https://www.univdev.page/posts/nextjs-hydration/
https://velog.io/@jhplus13/NextJS-React-Hydration-Error-%ED%95%B4%EA%B2%B0%EA%B8%B0