ElemeFE / ElemeFE/element-react
分页组件里有警告错误 :Do not mutate state directly. Use setState() react/no-direct-mutation-state
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 435
- PR merge metrics
- No merged PRs in 30d
Description
### Description
pagination分页组件里报警告
这个代码里:https://github.com/eleme/element-react/blob/master/src/pagination/Pager.jsx
我看到了源码中更新状态 是这样的:
this.state.showPrevMore = showPrevMore;
this.state.showNextMore = showNextMore;
this.state.quickprevIconClass = showPrevMore
? this.state.quickprevIconClass
: 'el-icon-more';
this.state.quicknextIconClass = showNextMore
? this.state.quicknextIconClass
: 'el-icon-more';

**能告诉我用this.state这样,而不用setState是有什么特别的吗?**
**能告诉我用this.state这样,而不用setState是有什么特别的吗?**
**能告诉我用this.state这样,而不用setState是有什么特别的吗?**
所以给出警报 :

https://github.com/eleme/element-react/blob/master/src/date-picker/basic/TimeSpinner.jsx
上面这个datepicker另外我还看到了这样的代码:
function withIndex(arr) {
return arr.map((e, i) => (e, i));
}
Contributor guide
Assessment
This issue has not been assessed yet.