In this article, we aim to create and publish a library that can be used, without any changes in the code, in both client side and server side applications.

We need to fulfill the following use cases:

  1. The library is written in ES6+, using import and export keywords
  2. The library can be used with a <script> tag
  3. The library can be used in a web application that uses a modern bundler.
  4. The library can be used in a node application.

Technically, this means the library needs to work in the following contexts:

Using a <script> tag:


In this article, we explain the new JSX Transform, and how to use JSX without React.

The official React blog does not get many updates, so a new post is always attention worthy, but this week’s post, Introducing the New JSX Transform, could be a much bigger deal than it seemingly appears.

In this post, Luna Ruan announces a new JSX Transform, and one of the benefits is that “you can use JSX without importing React.”.

For those who don’t know, JSX is the HTML like syntax which is used by React components to render in the browser:

When you use JSX, the compiler…


I received an email digest from a popular blogging platform which included after the first few serious and news worthy links some more click-baity content. The article that caught my eye is titled something along the lines of “Questions and Answers to Algorithm Interviews”. In my experience, with few exceptions, articles under the general theme of interview questions are not very good, they’re watered down versions of the real thing, but they must draw clicks because every blog has one. So an article like that surrounded by click-bait must surely fit that description. However, since this is an email digest…


In this article we’ll see how to use environment variables in a React application. Specifically, we’ll look at two kinds of environments variables:

  • Build time variables: these are variables that are provided when the application is compiled (typically when npm run build is executed). In our example, we’ll pass to the application the git hash of the code when it was built, and an additional arbitrary value.
  • Run time variables: these variables are provided when the application runs, usually these variables differ depending on the environments (development, staging or production). …


June 2021 update: while some of the content of this article remains accurate (and hopefully useful), it is a bit of a contrived example. It assumes that there is an existing REST api running on Express that needs to be maintained, while also exposing a GraphQL endpoint. In reality, a better solution would be to keep the REST api as is, and spin up another GraphQL endpoint as a separate server without mixing the two, there is no need to have the same server handle both REST and GraphQL queries, separation of concerns is I think a good thing. …


Redis is, according to its own website, “an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker”.

In other words, Redis can be used as a blazing fast cache, and it’s dead simple to use.

Let’s use as an example a simple Express application. It doesn’t really matter what it does, just know that when the user visits the / route, the greet function is called and it takes between 1 and 3 seconds to run.


Clean code is code that is easy to understand, easy to review and easy to change.

Ternaries, especially as one line functions, are rarely any of these things.

Let’s write a function that returns whether an integer is positive or negative. This can be simply and quickly written as is:

However, when testing the code, a test fails, the function returns ‘negative’ when the value is 0 but it should return an empty string (according to a spec that was not read to the end 🙄).

The new…


Before getting too deep in the weeds, we need to understand what immutability is. It all has to do with reference and value equality.

Reference equality: we compare references (pointers), and if the two instances are the same, then obj1 === obj2

Value equality: we compare values, and if the values are the same thenobj1.equals(obj2)

Reference equality is extremely quick and easy for a computer to do, all the computer does is check if the two objects share the same pointer (address in memory). Value equality takes a little more work because each value is compared individually. …


Working with currencies in JavaScript can be more complicated than it seems.

The first issue we have is that a monetary amount is usually represented using a float, so multiplying and dividing them can be tricky. Just try typing 10 / 3 or 3.33 * 3 in a JavaScript console.

Sometimes we need to use whole amounts, but more often than not we’ll be dealing with 2 or possibly more decimals, and for trading and crypto it’s not uncommon to use 4, 6 or even 8 decimals.

So the problem we have to solve is how to multiply and divide…


1. Use destructuring to swap variables

2. Use the Spread operator to create a function that accepts a variable number of arguments

3. Use the Spread operator to conditionally add a property to an object

Arnaud Dostes

Previously Paris and Geneva, currently New York. Can also be found at https://dev.to/arnaud

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