티스토리 뷰

props로 받아온 id를 html태그의 id로 넣어주려고 하는데 자꾸 에러가 떴다.

 

Type 'number' is not assignable to type 'string'.


이유

html id는 숫자로 시작할 수 없다. 이런 기본적인 것도 까먹다니 정신을 차려야한다....... 변수도 첫글자가 숫자면 선언이 안되는데!!!!!!!

 

W3C 문서

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

 

 

참고1

참고2

728x90
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함