Hardik Patel
Hardik Patel

Reputation: 937

Use react js with existing java web application

I am planning to use react js as V (from MVC) in my existing java web based application.

My concern is how do i run react js component on java web application server.

React js uses Node js components. And it has WebPack server which bundles code to single js file(bundle.js).

So May i directly use bundle.js(By copy and paste) to my existing application?

Or i need something else ?

Please suggest.

Thanks.

Upvotes: 2

Views: 1779

Answers (1)

Krzysztof Sztompka
Krzysztof Sztompka

Reputation: 7204

React is frontent technology. It work even from CDN. Node.js is backend technology, but it is also use as a tool to build your app. But after you built it then it is no more in use (until you make some changes)

What you have to do:

  1. Install nodejs and npm.
  2. Create your react app
  3. Use nodejs/webpack to build bundle

Now your bundle don't need node.js or webpack. It is normal js file. YOu can use it as you wish.

You can copy your bundle.js file to server where node.js is not installed and you use it in normal way and it will work.

Upvotes: 2

Related Questions