Warning Message
Line 82:31: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
Warning Message가 발생하는 이유
a 태그 사용시 유효한 값의 href 속성이 필요하다.
이런 태그는 strict mode에서 걸리게 되는데 href 속성이 없어도 안되고 유효하지 않아도 문제가 된다.
해결방법
<a href={()=> false}></a>
# or
<a href='#!'></a>
위와 같이 a 태그의 href 속성을 지정해준다.
참고자료:
프론트앤드 React <a>태그 사용시 나타나는 오류 해결하기
" React The href attribute requires a valid value to be accessible. " What....t..h.. 프론트앤드 공부하다보면 영어의 소중함을 알게된다.. 하아.. 어쨌든, 여기 찾아온 사람들은 아마 이 경고문을 보고 찾아..
chlolisher.tistory.com
반응형
댓글