首页 > 解决方案 > 删除 eslint error '解析错误:意外的令牌,预期的;(致命)'在反应本机代码中

问题描述

我在 react-native 中做一些代码并在我的代码中收到此错误“解析错误:意外令牌,预期“;”(致命)”

index.js

export const emailChanged = (text) => {
  rerutn {              ///getting error at this line//
  type: EMAIL_CHANGED,
  payload: text
  };
  };

.eslintrc

 {
"extends": "rallycoding",
 "rules": {
  "arrow-body-style": 1
}
}

标签: react-nativeeslint

解决方案


它必须return代替rerutn. 所以你的代码看起来像这样:

export const emailChanged = (text) => {
  return {
    type: EMAIL_CHANGED,
    payload: text
  };
};

推荐阅读