Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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 在ReactJS中使用主题_Javascript_Css_Html_Reactjs - Fatal编程技术网

Javascript 在ReactJS中使用主题

Javascript 在ReactJS中使用主题,javascript,css,html,reactjs,Javascript,Css,Html,Reactjs,我已经在最前面购买了一个主题,我想在我的ReactJS项目中使用它。由于我仍在学习React,我想知道是否可以像对待任何网站一样简单地将Style.css文件包含在“public/index.html”文件中,或者是否有一种特定的方法来进行反应?这是一种可接受的方法 或者,您可以在应用程序入口点文件中使用类似于require('./style.css')的内容,只要您设置了类似于webpack的内容。这是一种可接受的方法 或者,您可以在应用程序入口点文件中使用类似于require('./styl

我已经在最前面购买了一个主题,我想在我的ReactJS项目中使用它。由于我仍在学习React,我想知道是否可以像对待任何网站一样简单地将Style.css文件包含在“public/index.html”文件中,或者是否有一种特定的方法来进行反应?

这是一种可接受的方法


或者,您可以在应用程序入口点文件中使用类似于
require('./style.css')
的内容,只要您设置了类似于webpack的内容。

这是一种可接受的方法


或者,您可以在应用程序入口点文件中使用类似于
require('./style.css')
的内容,只要您设置了类似webpack的内容。

您只需将style.css文件包含在index.html中,并将样式表中定义的css类与您的组件一起使用即可。需要注意的是,您必须使用
className
而不是
class
来引用CSS类,因为React基本上是JavaScript代码,“class”在JS中是一个保留字。例如:

<div className="my-class">bla</div>
bla

您只需将style.css文件包含在index.html中,并将样式表中定义的css类与您的组件一起使用即可。需要注意的是,您必须使用
className
而不是
class
来引用CSS类,因为React基本上是JavaScript代码,“class”在JS中是一个保留字。例如:

<div className="my-class">bla</div>
bla