5 回答
TA贡献1906条经验 获得超3个赞
在 loginError 之前添加类型 ...
例如:
const loginError = props => { ... }
var loginError = props => { ... }
TA贡献1803条经验 获得超6个赞
基本上你应该得到'loginError is not defined',如果那是 lint,但这个错误是针对最新的 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"}
]
}
}
添加回答
举报