[ESLint] The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. valid.mdeslintjsx-a11y/anchor-is-valid

슈슈·2020년 7월 14일
0

Javascript

목록 보기
4/11
<Link href={`/serviceUrl?id=${service._id}`}>
  <a href="#">
  </a>
</Link>

이런 식의 코드는 esLint에 잡히게됩니다.

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/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.mdeslintjsx-a11y/anchor-is-valid

a태그 사용시 유효한 href 값이 있어야 한다는 뜻 입니다.

그래서 이런 경우엔 코드를 수정해 주어야하는데 방법은 크게 두가지가 있습니다.

<a href="#!">
<a href={() => false}>
profile
정리용😊

0개의 댓글