[英]Linting in React
I am learning React.js. 我正在学习React.js。 I am developing an app.
我正在开发一个应用程序。 My code is like below
我的代码如下
<div className="ui pagination menu">
<span
className={
this.props.page === 1
? 'disabled item pagination'
: 'item pagination'
}
onClick={() => {
if (this.props.page === 1) {
return false;
}
this.pagination(this.props.page - 1);
}}
>
❮
</span>
<div className="item">
Page {this.props.page} of {this.props.maxPages}
</div>
<span
className={
this.props.page === this.props.maxPages
? 'disabled item pagination'
: 'item pagination'
}
onClick={() => {
if (this.props.page === this.props.maxPages) {
return false;
}
this.pagination(this.props.page+1);
<h1 className="ui attached warning message table"> // Line 185
<span id="address">Addresses</span>
<span id="user_details">
Welcome, <b> { this.state.userName } </b> |
<span id="logout" onClick={this.logout}> Logout </span>
<button className="ui teal button" onClick={this.openPopup}> <i className="plus square icon" />
Add Address
</button>
</span>
</h1>
{this.props.addresses.length > 0 ? (
I am getting Warning
like below 我收到如下
Warning
Line 185: Expected an assignment or function call and instead saw an expression no-unused-expressions
Could anyone say how can I solve the Warning
? 谁能说我该如何解决
Warning
?
I think you have missed closing of onClick
function before your line 185
, you should do this, 我认为您在
line 185
之前错过了onClick
函数的关闭,应该这样做,
<span
className={
this.props.page === this.props.maxPages
? 'disabled item pagination'
: 'item pagination'
}
onClick={() => {
if (this.props.page === this.props.maxPages) {
return false;
}
this.pagination(this.props.page+1);
}} //This is missing
> //closing of span is also missing
<h1 className="ui attached warning message table"> // line 185
I believe you are missing the closing statement for the onClick. 我相信您错过了onClick的总结声明。 It may be helpful to use and IDE and install prettier.
使用和集成开发环境可能会有所帮助。 This will help you see where you are missing syntax.
这将帮助您查看缺少语法的地方。 Additionally, here is more information on the rational for the error:
此外,以下是有关错误原因的更多信息:
http://linterrors.com/js/expected-an-assignment-or-function-call http://linterrors.com/js/expected-an-assignment-or-function-call
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.