Skip to Content

React.JS in the HANA Cloud Platform

One of the great things about HANA Cloud Platform (HCP) is how flexible it is with multiple different technologies.

But, I’ve run in to the following question at many of the talks and CodeJam’s I have presented at during the past year:  If our organization doesn’t want to use SAP UI5, what other platforms should I use?

The problem is that almost all of our HCP documentation talks about UI5.  This makes sense, since we wrote UI5 and therefore almost all of the tools for it are part of HCP.  In fact, when you start a project, almost all of the choices are about which version of UI5 to use.  But, this doesn’t mean that UI5 is your only option.   HCP supports many other front end toolkits.

So, we wrote a new set of tutorials:  REACT with HANA Cloud Platform.

What is React.JS?

Basically, React.JS another JavaScript framework to help build Single Page Applications (SPA’s).

Okay.  I admit, that’s the stock answer.  To best describe it, start with UI5.  Most of UI5 is written and is stored on a server (like HCP), but really, UI5 runs entirely in a browser.  It’s a bunch of JavaScript libraries, which load your custom code (in JavaScript) and configurations (in XML).  UI5 code is sent from the server to the browser – and the browser is where all of the computing and work is done.

React runs the same way.  It is also a JavaScript library, which is loaded by the browser.  You write your own JavaScript to connect everything together.  All of the code – the work – is done on the browser as well.

React was written by Facebook, who is also the primary supporter.  So the framework is very well designed, and is actively updated and bugs are fixed.  It’s a very popular framework, second only to Angular.JS in the current space.

 

Differences between React and UI5

There are several major differences between UI5 and React – starting with the fact that UI5 was written by SAP, and React by Facebook.

React, like UI5, is a code-centric framework.  Most of the work that a programer will do in React is in JavaScript.  But, unlike UI5, React also expects the application look and feel to be created by the programmer.  This means React is more flexible in it’s look and feel, but also more complicated because some design and CSS is required.

UI5 contains a lot of pre-built components that come “in the box”.  React doesn’t have any components in the core libraries.  But, like most open source systems, there are multiple projects out there which provide large numbers of custom components.  Both frameworks allow you to create your own components, customizing the code as much as you want.

Finally, UI5 is very good with OData.  React doesn’t have any data components built in – again, this is the job of other open source libraries.  Since JSON, and not OData, is the preferred language of most open-source libraries, the OData support tends to move everything in (and out) of JSON, adding an extra step.  With the modern JavaScript engine, I suspect you will not notice any delay in processing.

 

Which should you choose?

Which is better?  This seemingly easy question is actually very hard to answer.

Many organizations ask the “architecture” group to come up with a set of standards.  Those standards cross lots of technologies and programs.  So, you should choose the front end library that makes the most sense to you.

Feel free to use SAP UI5, React, Angular.JS, or your own choice of framework.  HCP supports all of them!

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Bharath Raja S

    Hi Jonathan,

    Very well explained blog.

    In this blog you have covered details based on O-data perspective, I have couple of questions. It will be very helpful if you can provide me some pointers.

    1. Can we use React based on Netweaver gateway if HCP is not available?
    2. Can we use node js server that is present in XS engine to run react applications instead of using Odata.

    Thanks in advance.

    Regards,

    Bharath

     

     

    (0) 
    1. Jonathan Baker Post author

      Bharath,

      Those are great quesitons.

      React.JS is a client side scripting language, which means you don’t need to “run” it on any cloud based server.  It could certainly run on a Netweaver Gateway server, because Gateway would only be supplying the files to the client.

      As far as running Node.JS – you can do that.  You can run the back end on anything you want.  The React.JS front end will make REST calls back to any back-end web server.  In this example, it calls back to SAP Cloud for OData.  If you were using Node.JS, you could respond with JSON instead.  React.JS will work with either.

      Let me know if this answers your question!

       

      Cheers,

      Jonathan

      (0) 

Leave a Reply