javascript - SyntaxError : C:/workspace/src/app. jsx:意外标记 (115:36)

标签 javascript html css reactjs redux

我是新手。 我遇到语法错误,你能告诉我为什么会这样吗? 提供以下代码。

Module build failed: SyntaxError: C:/workspace/src/app.jsx: Unexpected token (115:36)
  113 |                                 <h6>Your rollover to a  IRA is in progress...</h6>
  114 |                                 {
> 115 |                                     if(this.props.sportsInfo.fundingDetailId === null || this.props.sportsInfo.fundingDetailId === undefined || this.props.sportsInfo.fundingDetailId === '') 
      |                                     ^
  116 |                                     {
  117 |                                         App.rollOverNoContent();
  118 |                                     }

最佳答案

答案就在 docs 中:

if statements and for loops are not expressions in JavaScript, so they can't be used in JSX directly. Instead, you can put these in the surrounding code.

你的 JSX 必须是一个表达式(粗略地说,它必须返回一些东西)。您可以在此 article 中阅读更多内容来自@rauschma。

关于javascript - SyntaxError : C:/workspace/src/app. jsx:意外标记 (115:36),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42310648/

相关文章:

php - 你能举例说明在 flex 应用程序中使用 php 吗?

javascript - 无法从 React Native 中的父组件调用子组件方法

javascript - return false onclick anchor 不完全工作

javascript - 如何滚动 div 使其在 ReactJS 中可见?

html - 垂直居中内容

javascript - 从当前页面刷新不同的页面

javascript - 使用公司代理服务器的 Web 应用程序性能

html - IE 中的 CSS 100% 高度

javascript - ins的问题

javascript - 在 vuetify 中将覆盖层放在 fab 按钮上