๋ฌธ์
Warning: React does not recognize the isVisible prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase isVisible instead. If you accidentally passed it from a parent component, remove it from the DOM element.
<DeadlineWrapper
isOverdue={work.workDeadline < today}
isDueToday={work.workDeadline === today}
>
{work.workDeadline < today
? "๋ง๊ฐ๋ ์ง๊ฐ ์ง๋ todo์
๋๋ค !"
: work.workDeadline === today
? "์ค๋๊น์ง ๋๋ด์ผํ๋ todo์
๋๋ค !"
: null}
</DeadlineWrapper>
const DeadlineWrapper = styled.div`
color: ${(props) =>
props.isOverdue ? "#e88d8d" : props.isDueToday ? "#FFF1A7" : "inherit"};
font-size: 0.7rem;
`;
์ด๋ฐ์์ผ๋ก ๋ง๊ฐ๋ ์ง๊ฐ ์ง๋ ๊ฑฐ์ ๋ํ๊ฑด ๋นจ๊ฐ์, ์ค๋ํด๋นํ๋๊ฑด ๋ ธ๋์์ผ๋ก ํํํ๊ณ ์
props๋ก ๋๊ฒจ์ ํด๋นํ๋ ๊ฒ์ ๋ฐ๋ผ ์ ๋ณ๊ฒฝ์ ํ๋ ค ํ๋๋ฐ ์ค๋ฅ๊ฐ ๋ด๋ค.
camleCase๋ก ์์ฑํ ๊ฒฝ์ฐ ๋ฆฌ์กํธ๋ DOM ์์๋ก ์ธ์ํ๊ฒ ๋๋๋ฐ,
๋ฆฌ์กํธ์์ isOverdue๋ผ๋ ์ ์ ๋์ง ์์ ์์ฑ์ ์ฌ์ฉํ๋ คํ๋ ์ค๋ฅ๊ฐ ๋ฌ ๊ฒ์ด๋ค.
๊ทธ๋์ camleCase ๋ฐฉ์์ด ์๋ ์๋ฌธ์๋ก๋ง isoverdue๋ก ์ ์ด๋ ๊ฒฝ๊ณ ๋ฌธ๊ตฌ๊ฐ๋จ๋๋ฐ, ์ด ๊ฒฝ๊ณ ๋ฌธ๊ตฌ๊น์ง ์์ ๊ธฐ ์ํด์ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ค.
ํด๊ฒฐ
'$' ์ ํตํด props๋ฅผ ํํฐ๋ง ํ ๊ฒฝ์ฐ DOM์ผ๋ก ์ ๋ฌ ๋์ง ์๋๋ค.
<DeadlineWrapper
$isOverdue={work.workDeadline < today}
$isDueToday={work.workDeadline === today}
>
{work.workDeadline < today
? "๋ง๊ฐ๋ ์ง๊ฐ ์ง๋ todo์
๋๋ค !"
: work.workDeadline === today
? "์ค๋๊น์ง ๋๋ด์ผํ๋ todo์
๋๋ค !"
: null}
</DeadlineWrapper>
const DeadlineWrapper = styled.div`
color: ${(props) =>
props.$isOverdue ? "#e88d8d" : props.$isDueToday ? "#FFF1A7" : "inherit"};
font-size: 0.7rem;
`;
์์ ๊ฐ์ด $์ ์ถ๊ฐํด์ฃผ๋ฉด ์ค๋ฅ๊ฐ ์ฌ๋ผ์ง๊ณ ์ ์ฉ์ด ๋๋ค !