9
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

jsxでアポストロフィを使う【eslintreact/no-unescaped-entities】

Posted at

問題

Reactのjsx内にアプストロフィを含む文字列を記述しようとしたらESLintのエラー(eslintreact/no-unescaped-entities)に引っかかった。
スクリーンショット 2021-03-02 15.07.34.png

解決方法

文字列の'(アポストロフィ)の箇所を',‘,',’のどれかに変換する。

<Link href="/user/signUp" variant="body2">
    Don't have an account? Sign up           // エラー
    Don&apos;t have an account? Sign up     // OK
    Don&lsquo;t have an account? Sign up   // OK
    Don&#39;t have an account? Sign up     // OK
    Don&rsquo;t have an account? Sign up   //OK
</Link>
              
9
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?