
程序运行报错:
devScripts.js:6523 The above error occurred in the <div> component:
at div
at IndexPage
at IndexPage
at div
at IndexPage
at LoadableComponent (http://localhost:8130/mf-dep_vendors-node_modules_babel_runtime_helpers_esm_extends_js-node_modules_babel_runtime_helpers_-424ef3.f230f37e.async.js:474:68)
at Route
...代码部分:
import React from 'react';
import styles from './index.less';
const IndexPage: React.FC<{}> = () => {
return (
<div className={styles.titleHead}>
<div className={styles.titleName}>板块</div>
<div className={styles.titleInfo}>
<div className={styles.tabControl}>
<div style={styles.tabItem}>累计</div>
</div>
</div>
</div>
);
};
export default IndexPage;很难发现,累计一行, div 属性应该是 className ,这里错写成了 style 所以引发了报错。
style 的属性应该是一个 {} 。
未经允许不得转载:w3h5-Web前端开发资源网 » 一个属性引发的React报错:The above error occurred in the component