Promises, async/await statements, generators are the possible technologies to implement asynchronous hooks that change the internal state of a React component.

A simple app will be used to illustrate the three different approaches, highlighting the advantages/disadvantages of each.

The component hierarchy of the app UI will be built using the styled components library. It elegantly solves the problem of integrating CSS into the JavaScript source file, while preserving the full potential of CSS rules.

Use Case

The app we are building will display a set of personal names, randomly extracted from a dictionary.

Since the intention is to describe the synchronization of…


A simple exercise in functional React/JavaScript that exemplify a common use-case with date pickers.

In the following I will refer to the widely used react-datepicker component, although the considerations I will make can be applied to any date picker that provides similar capabilities.

The Problem

React-datepicker component provides two properties to constraint the selection of dates: minDate and maxDate.

When the minDate property is set, previous days cannot be selected and browsing to previous months is inhibited. The same happens in the opposite direction with maxDate.

If you enable the time picker section and specify a minDate that contains a minimum time…


An in-depth analysis of equality concept in programming languages.

Grignetta, Grignone, Resegone, Legnone

Four flavors for object equality seems too much: objects have a unique identity. Very often, however, when we say that two entities are equal we do not mean they are physically the same object, but we are referring to a set of physical objects that have properties that make them equivalent.

E.g. to replace a light bulb with one equal bulb we mean: same color temperature, same brightness, same power consumption.

In programming languages it is important to distinguish between four different meanings of equality. …


The reshuffling of the elements of a vector can be obtained with two simple and very similar algorithms:

the vector is traversed in one direction (can be indifferently left to right or right to left) and each element is exchanged with an element chosen at random respectively among the successive elements of the vector (Durstenfeld’s algorithm) or among the previous elements (inside-out algorithm)¹.

Assuming to scan from left to right, the following image illustrates the difference between the two algorithms (targets positions of red arrows are chosen randomly)

Giancarlo Radaelli

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store