Multi-stage Docker build for React and Spring

Docker makes it easy to deploy web applications. In the case of a simple web application, the server can contain both the backend and the static resources of the frontend such as JavaScript files, images, CSS files, etc. But in order to create our container we need to build our backend and frontend first. We can quite easily install everything on our computer to build both our backend and our fron...

Reactive programming with Reactor

In Java, we are constantly manipulating various sequences of data in our applications. Most of the time, this is done thanks to implementations of Iterable and Iterator. Java 8 gave us more modern APIs for sequences of data with both Optional and Stream. Those two new concepts provide us with great APIs to manipulate sequences of respectively 0..1 elements and 0..n elements. Optional.of("first").i...

Handling events in React

Now that have seen how to create stateless and stateful React components , we are going to see how to handle DOM events with a class-based component. You can handle events with React in a similar fashion as with DOM elements with some minor differences. With JSX, you will have to use properties using the camel-case version of the name of the event that you want to handle. On top of that, you won’t...

First React component

After a first part where we have seen how to get move from vanilla JavaScript to React, let’s see how we can create real React components. In order to introduce some dynamicity in our React code, we would like to execute functions to compute some JSX instead of relying only on static JSX code. We are lucky since React.createElement can take not only the name of a standard element (like div or h1 )...

From Vanilla JavaScript to React

React is a JavaScript framework used to build user interfaces. It can be used to create JavaScript applications by manipulating dynamically the content of the page. The browser already provides an API to create elements in the page, the DOM, so newcomers may wonder what does React bring to the table and how it relates to the DOM. Vanilla JavaScript and the DOM In JavaScript, just like in most prog...