第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在 React 項(xiàng)目中配置 ESLint 后在箭頭函數(shù)中拋出錯(cuò)誤

在 React 項(xiàng)目中配置 ESLint 后在箭頭函數(shù)中拋出錯(cuò)誤

呼啦一陣風(fēng) 2022-10-13 17:18:13
我正在做一個(gè) React 項(xiàng)目,我在我的項(xiàng)目中配置了 ESLint。在該配置之后,我得到了我在圖片中提到的錯(cuò)誤:為什么 ESLint 會(huì)拋出這個(gè)錯(cuò)誤以及如何解決這個(gè)問(wèn)題?
查看完整描述

5 回答

?
一只名叫tom的貓

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超3個(gè)贊

在 loginError 之前添加類型 ...

例如:

const loginError = props => { ... }

var loginError = props => { ... }


查看完整回答
反對(duì) 回復(fù) 2022-10-13
?
ibeautiful

TA貢獻(xiàn)1993條經(jīng)驗(yàn) 獲得超6個(gè)贊

您需要使用 或 聲明loginError箭頭var let函數(shù)const



查看完整回答
反對(duì) 回復(fù) 2022-10-13
?
海綿寶寶撒

TA貢獻(xiàn)1809條經(jīng)驗(yàn) 獲得超8個(gè)贊

查看錯(cuò)誤處理。try&catch功能更簡(jiǎn)潔的代碼



查看完整回答
反對(duì) 回復(fù) 2022-10-13
?
慕絲7291255

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊

你應(yīng)該用 const 聲明函數(shù)。

const loginError = props => {
  ...
  }


查看完整回答
反對(duì) 回復(fù) 2022-10-13
?
慕碼人8056858

TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個(gè)贊

基本上你應(yīng)該得到'loginError is not defined',如果那是 lint,但這個(gè)錯(cuò)誤是針對(duì)最新的 ES6 的。我的 eslintrc.json 是


{

    "parser": "babel-eslint",

    "env": {

        "browser": true,

        "es6": true

    },

    "extends": [

        "plugin:react/recommended",

        "standard",

        "eslint:recommended"

    ],

    "globals": {

        "Atomics": "readonly",

        "SharedArrayBuffer": "readonly"

    },

    "parserOptions": {

        "ecmaFeatures": {

            "jsx": true

        },

        "ecmaVersion": 2018,

        "sourceType": "module"

    },

    "plugins": [

        "react"

    ],

    "rules": {

    },

    "settings": {

        "react": {

            "createClass": "createReactClass", // Regex for Component Factory to use,

                                               // default to "createReactClass"

            "pragma": "React",  // Pragma to use, default to "React"

            "version": "detect", // React version. "detect" automatically picks the version you have installed.

                                 // You can also use `16.0`, `16.3`, etc, if you want to override the detected value.

                                 // default to latest and warns if missing

                                 // It will default to "detect" in the future

            "flowVersion": "0.53" // Flow version

          },

          "propWrapperFunctions": [

              // The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.

              "forbidExtraProps",

              {"property": "freeze", "object": "Object"},

              {"property": "myFavoriteWrapper"}

          ],

          "linkComponents": [

            // Components used as alternatives to <a> for linking, eg. <Link to={ url } />

            "Hyperlink",

            {"name": "Link", "linkAttribute": "to"},

            {"name": "a", "linkAttribute": "href"}

          ]

    }

}

查看完整回答
反對(duì) 回復(fù) 2022-10-13
  • 5 回答
  • 0 關(guān)注
  • 183 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)