I have a spring project and I have added react, jquery and bootstrap webjars in my project. I want to use them in react as import statements.
My pom Dependency:
`<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>`
I want to know how to use react and jquery in my react project .
This is how I include react and jquery in my Maven project:
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>
In webpage I refer to the libraries as follows:
<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 IDEA will help you getting the path's right. Note that you may have to force a Maven reload libraries if autocompletion does not work...
Also note that react and react-dom separated into two different webjars somewhere between 15.0.1 and 15.6.1. In 15.0.1 both react and react-dom is in the same library.
Best regards from Ove