๐Ÿ‘ฉ‍๐Ÿ’ป๊ฐœ๋ฐœ_TIL/์—๋Ÿฌ

[๋ฆฌ์•กํŠธ]<a> cannot appear as a descendant of <a>

Daisy.lee 2021. 12. 13. 13:59

react-router์˜ Link์™€ <a>ํƒœ๊ทธ์˜ ๊ธฐ๋Šฅ์ด ์ค‘๋ณต๋˜์–ด ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค.

<Link>๋ฅผ ์ง€์šฐ๊ณ  aํƒœ๊ทธ์˜ ์†์„ฑ์— as={Link}์™€ to="์—”๋“œํฌ์ธํŠธ" ์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

 

 

 

as = {Link} aํƒœ๊ทธ๋ฅผ Link ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๊ณ  ์ •ํ•ด์ค๋‹ˆ๋‹ค.

to = "์—”๋“œํฌ์ธํŠธ" Link์™€ ๋™์ผํ•˜๊ฒŒ ์ด๋™ํ•  ์ฃผ์†Œ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

ํฌ์ธํŠธ๋Š” as๋ผ๋Š” ํ‚ค์›Œ๋“œ๋กœ <a> ํƒœ๊ทธ๋ฅผ <Link> ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์ ์ž…๋‹ˆ๋‹ค.๐Ÿ˜Ž