我有一个spring项目,我在我的项目中添加了react、jquery和bootstrap webjars。我想在react中使用它们作为import语句。
我对pom的依赖:
`<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>react</artifactId>
<version>15.3.2</version>
</dependency>`我想知道如何在react项目中使用react和jquery。
发布于 2017-08-09 22:47:04
这就是我如何在Maven项目中包含react和jquery的方式:
pom.xml
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>react-dom</artifactId>
<version>15.6.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.2.1</version>
</dependency>在网页中我引用库如下:
<script src="webjars/react/15.6.1/react.min.js"></script>
<script src="webjars/react-dom/15.6.1/dist/react-dom.min.js"></script>
<script src="webjars/jquery/3.2.1/jquery.min.js"></script>Intellij的想法将帮助你找到正确的道路。请注意,如果自动完成不工作,则可能必须强制Maven重新加载库.
还要注意的是,在15.0.1和15.6.1之间的某个地方,react和react被分隔成两个不同的webjars。在15.0.1中,react和react dom都在同一个库中。
欧夫致以最良好的问候
https://stackoverflow.com/questions/44308960
复制相似问题