๊ฐœ๋ฐœ/โŒ ์˜ค๋ฅ˜ ๋…ธํŠธ

[๋ฆฌ์•กํŠธ ์—๋Ÿฌ๋…ธํŠธ]Error: Input Is A Void Element Tag And Must Neither Have `Children` Nor Use `DangerouslySetInnerHTML`.

๋ฐ(Ming) ๐Ÿˆ‍โฌ› 2022. 2. 17. 23:25
728x90
๋ฐ˜์‘ํ˜•

โŒ Error: input is a void element tag and must neither have children nor use dangerouslySetInnerHTML.

 

react ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ๊ณผ์ • ์ค‘์— ์ฒ˜์Œ์œผ๋กœ component ๋‹จ์œ„๊ฐ€ ์•„๋‹ˆ๋ผ element ๋‹จ์œ„๊นŒ์ง€ ์ชผ๊ฐœ์„œ ๋งŒ๋“ค์–ด๋ณด๊ณ  ์žˆ๋‹ค. ๋กœ๊ทธ์ธ ํผ์— ๋“ค์–ด๊ฐˆ input ๋ถ€๋ถ„์„ ๋งŒ๋“œ๋Š” ๊ณผ์ •์—์„œ ๋งŒ๋“  ์—๋Ÿฌ!

 

styled component๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ณผ์ •์—์„œ input์€ ๊ทธ๋Œ€๋กœ ์ ์šฉํ•  ์ˆ˜ ์—†๊ณ , div๋กœ ํ•œ๋ฒˆ ๊ฐ์‹ธ์ค˜์•ผํ•œ๋‹ค. ๊ทธ๋ž˜์„œ InputForm์„ ๋งŒ๋“ค์–ด ๋‘๊ณ  ๋ฐ‘์— ์ ์šฉํ•  ๋•Œ๋Š” div๊ฐ€ ์•„๋‹ˆ๋ผ input์œผ๋กœ ์ ์šฉํ–ˆ๋”๋‹ˆ ์ €๋Ÿฐ ์—๋Ÿฌ๋ฅผ ๋งž์ดํ–ˆ๋‹ค. div๋กœ ์ˆ˜์ •ํ•ด์ฃผ๊ณ  ์˜ค๋ฅ˜ ๊ณ ์นจ!

๋ญ๋ž„๊นŒ ์žฌ์‚ฌ์šฉ์ด ์šฉ์ดํ•˜๊ฒŒ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋‚˜๋ˆ„๊ณ  ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ๋‚˜๋ˆ„๋Š”๊ฑด๋ฐ, ์˜คํƒ€ํŒŒํ‹ฐ๋กœ ์˜ค๋ฅ˜๋ฅผ ๋งŒ๋‚˜๊ณ  ์žˆ๋‹ค 

 

 

 

 

 

728x90