LoginSignup
1
0

More than 1 year has passed since last update.

【React】Expected an assignment or function call and instead saw an expression no-unused-expressionsの対処法

Last updated at Posted at 2021-06-05

症状

Reactのコードをコンパイルした時に、以下のエラーが発生しました。

error
Expected an assignment or function call and instead saw an expression  no-unused-expressions

そのまま翻訳すると、
「割り当てまたは関数呼び出しが予期されていましたが、代わりに未使用の式のない式が表示されました」

エラーが出たソースは以下です。

Hoge.jsx
import React ,{ Fragment} from 'react';1

export const Hoge= () => {
    return(
      <Fragment>
        "Fuga"
      </Fragment>
    )
}

解決策

importの後に1が入っていたため、起きていました。
1を取り除いたら、エラーが解消されました。

Hoge.jsx
import React ,{ Fragment} from 'react';

export const Hoge= () => {
    return(
      <Fragment>
        "Fuga"
      </Fragment>
    )
}
1
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
1
0