How is Angular 4 different from React

What is the difference between React and frameworks like Angular and Vue.js?

React is a JavaScript library that provides a basic framework for the output of user interface components from websites. Our trainer Simon Skoczylas from Karakun AG is an enthusiastic React developer and will soon be holding the first React training at Eppleton. In the interview, he explains what convinced him about React so much.

Hi Simon, we look forward to welcoming you as a trainer at Eppleton. You will hold your first training session with us on May 6th on the subject of React. Why did you get so excited about React and what are the differences compared to other frameworks such as Angular or Vue.js?

Hi Toni, I'm looking forward to holding React training sessions with you soon. First of all, React is not a framework. It's really just a library. The new JQuery. ☺

When I started with React, there was only AngularJS (not Angular) and no Vue.js. AngularJS felt a lot more cumbersome than React and I felt I understood React much faster. I am particularly enthusiastic about the simplicity and freedom in implementation. On the other hand, this can of course lead to problems and misunderstandings: “With great power comes great responsibility”.

You can choose the tools and the process. You can, but don't have to, use TypeScript, Flow or PropTypes. So I can be punk and hack, but also work sensibly and in a structured manner with larger teams. It is therefore just as suitable for small private projects as it is for enterprise applications.

The separation between React and the renderer, most of which will probably know ReactDOM, is very exciting. React enables a “learn once, write anywhere” approach. Best examples are ReactNative and ReactVR.

I also think the documentation and the community are really good. I feel that there is a solution in React for every problem.

AngularJS did a lot right with the move to Angular, learned from its own mistakes and copied something from React, similar to Vue.js. Angular, Vue.js, and React are valid options when building a web application. As always, it depends on the given boundary conditions which framework or library I would prefer. My personal order would be React, Vue.js, and Angular.

React relies on a unidirectional data flow and a virtual DOM in order to be able to implement even complex applications with high performance. What is the advantage of this approach?

With unidirectional data flow (one-way), in my opinion, it is easier to understand where the data is coming from and which path it is taking, and above all, troubleshooting is easier. With the bidirectional data flow (two-way) I have a connection to the data model, a kind of magical relationship is created. Both approaches have their appeal. The best approach is usually the unidirectional data flow, especially in combination with the immutability of the data.

When it comes to VirtualDOM, opinions differ widely. One side is of the opinion that operations on the DOM are not resource-intensive and changes can be written directly to the DOM, while others swear by the VirtualDOM approach. Basically, I think the idea that only relevant changes are adopted in the DOM is very good. Here, developers can still turn the performance screw by intervening in the life cycle of React and helping React to recognize which changes are relevant. Since the revision in React 16, under the title "Fiber", it has mainly been about incremental changes. The speed differences can be clearly seen in this demo.

The mix of HTML and JavaScript in JSX is viewed critically by some developers. Some even feel reminded of the way PHP generates web pages. Doesn't mixing code and markup contradict the declarative approach React otherwise takes?

Should I mention now that I once wrote PHP applications? ☺ I have also worked with JSP scriptlets that allow a mixture of HTML and code. React does not try to artificially separate markup and logic, but encapsulates the content for the view in components. Everything for a component CAN be stored in one file. They even go so far as to include CSS in the JavaScript files. So you have definition, functionality and appearance in one file. One component is self-contained. Even if I delete a component, there are no “remnants” left in other files. But again, I don't have to use JSX.

In your Nighthacking at Eppleton you explained that React is a library and not a framework. This gives the user a lot of freedom when using React in a project. In contrast, frameworks such as Angular relieve the developer of many decisions about how the application is to be set up. Are there any recommended frameworks that use React and help build React applications?

As far as I know, there is no framework comparable to Angular, which uses React as a view. You can use any framework and then implement the view with React. The "create-react-app" tool helps you to create and structure a React project.

What kind of projects do you think React is best for and when is it better to use a different technology?

React (with ReactDOM) can be used for any web application. For example SPAs with a REST or GraphQL backend. This is reflected in the list of companies that use React. These include Facebook, Netflix, eBay, Airbnb and DHL. Thanks to the versatile renderer, it can also be used for mobile apps or VR. It depends on the use case and the team. Similar questions arise with JavaEE and Spring Boot. What particularly impressed me about React is that it has managed without serious breaking changes for years and is downward compatible. The hooks in React 16.8.4 also bring innovations, but do not change the implementation of existing applications.

Thank you for your assessment; we look forward to your training with us!

With pleasure. See you. ☺

Suitable training

React training with Simon Skozczylas

DukeScript Workshop - modern Guis with java and HTML