Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 模块化CSS样式不起作用_Javascript_Css_Reactjs - Fatal编程技术网

Javascript 模块化CSS样式不起作用

Javascript 模块化CSS样式不起作用,javascript,css,reactjs,Javascript,Css,Reactjs,我已经使用create react app创建了一个样板react app 现在,在我的App.js文件中 import classes from './App.css'; 我做到了 <div className={classes.App}> <Cockpit showPersons = {this.state.showPersons} persons = {this.state.persons} />

我已经使用
create react app
创建了一个样板react app

现在,在我的
App.js
文件中

import classes from './App.css';
我做到了

<div className={classes.App}>
      <Cockpit 
        showPersons = {this.state.showPersons}
        persons = {this.state.persons}
      />
      {persons}
</div>
我的控制台中没有错误。 我也看不到任何
网页包模块配置
文件

我做错了什么?

我发现了错误。
要在react中使用模块化CSS样式,您需要弹出网页包配置设置。

请在上面的帖子中显示您的App.CSS。@Lynx请查看我的updates.import./App.CSS';将导入更改为thisclassName={'App'}使用css类,如this@ShubhamAgarwalBhewanewala这是默认的正确答案。我问的是模块化css样式,它对应于特定的react组件。
.App {
  text-align: center;
}