JAY*_*AYY 6 jsx reactjs eslint
我对此很陌生,面临这个错误,不太确定它意味着什么。
错误:树上的预期属性简写:树 - 由 eslint 触发?
import {
tree, tree1, tree2, tree3, tree4,
} from './Tree';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
tree: tree,
downloadingChart: false,
config: {},
// highlightPostNumbers: [1],
};
}
Run Code Online (Sandbox Code Playgroud)
Dea*_*mes 10
ESLint 希望您在状态对象中使用简写:
this.state = {
tree,
downloadingChart: false,
config: {},
// highlightPostNumbers: [1],
};
Run Code Online (Sandbox Code Playgroud)
如果您引用的变量与您定义的键同名,则不必声明键和值。您还可以使用 ESLint 的对象速记规则来停用此功能。
| 归档时间: |
|
| 查看次数: |
4540 次 |
| 最近记录: |