【发布时间】:2019-07-22 12:47:26
【问题描述】:
- 我正在尝试打印 sports 属性中的值。
- 所以我给了游戏里面的控制台。
- 但它会抛出语法错误。
Syntax error: C:/codebase//src/containers/sports.js: Unexpected token, expected , (367:22) - 我研究了打印值是否需要将 if 条件放入方法中,然后在此处调用它。
- 或者还有其他更简单的方法来打印 player.west.sports。
- 在下面提供我的代码 sn-p。
<GeoJSON
data={West}
onEachFeature={this.onEachFeature}
ref="west"
style={
map.region === "west" ? this.getNewStyle : this.getWhiteStyle
}
sports={
{console.log(" player.west.sports--->", player.west.sports)}
map.region === "west" ? (
player.west.sports
) : (
player.white.sports
)
}
/>
【问题讨论】:
-
sports属性应该是什么?为什么不在组件外部(上方/下方)打印您的东西?
标签: javascript html css reactjs redux