Since our nosedive in Javascript there is a ton of things to learn and the greatest new insights are written down in posts in this category.

Unit testing React Components

Posted in Javascript on June 20, 2016

In the latest posts we set up a darts game in React. We discussed the setup and performance, but no word about testing so far. In today’s post it is time to change this: We are going to setup unit tests for the React components. Although this seems overkill for a small app, the small app may grow over time or you might refactor parts of it. Automatic tests keep you covered during development. Also, the tests describe the components in normal words which makes it more easy for others to use your components.

Read more

React toy project: Tactics (part 3)

Posted in Javascript on May 23, 2016

In parts 1 and 2 of this tutorial I created a working prototype of the Tactics dartgame in React. Playing it for a while you probably noticed it was not as performant as you would like. In this tutorial we discuss the reason for this. In short it all boils down to a correct implementation of the shouldComponentUpdate function. But you don’t have to write this function yourself, just use Immutable state in combination with the PureRenderMixin mixin to obtain a great boost in performance.

Read more

React toy project: Tactics (part 2)

Posted in Javascript on May 9, 2016

In part 1 of this series I introduced the dartgame Tactics. So far, only the static version was created. In this post the app becomes fully functional. First, we carefully define the state of the app. Then interactivity is added by hooking up events to the interface to enable playing the game. These events trigger state changes and rerender the interface of the game. Read on for all details!

Read more

React toy project: Tactics (part 1)

Posted in Javascript on April 25, 2016

Today it is time to get started with some real React code. Following the approach described in ‘thinking in React’, we start with the setup of a static version of the app. The app we consider is a dartgame called Tactics. In short, two players hit the numbers 20 to 10 three times each. Once a number is completed (i.e., you hit it three times but your opponent did not), you can score points by hitting the number again. When both players have all numbers completed the points are calculated and the player with the highest score wins.

Read more

React and JSX: my reminders

Posted in Javascript on April 4, 2016

JSX is the language that React uses to render components. At first glance the syntax is a bit weird but in this post I write down some of the peculiarities in a reminder list. A very simple login form component is included to show how to use JSX in practice.

Read more

Starting with React

Posted in Javascript on March 10, 2016

2015 was definitely React year. React is the hot new framework build by Facebook and in my opinion worth checking out. Starting with React seems to be a bit difficult so after reading a lot of ‘starting with React’ posts, I decided to buy a premium course. In this and coming posts my thoughts on that.

Read more

Using npm packages in Javascript

Posted in Javascript on December 3, 2015

npm is a big resource of Javascript packages. With some easy commands you just include whatever package directly in your project. The package.json file is very important for several reasons and we will discuss a few in this post.

Read more

Modular Javascript inside a Laravel 5 project

Posted in Javascript on November 10, 2015

Here we describe a typical approach of modular Javascript inside a Laravel 5 project. We start by creating some modules and continue the whole process from dependency management towards bundling, minification and creating production ready Javascript. This process is extremely easy to setup using Laravel Elixir with Browserify. You just have to put your files in the right place!

Read more

JS: The story of merging and minifying your code

Posted in Javascript on October 10, 2015

To merge or not to merge? That’s the question for Javascript developers. When you are working on the code you want to split your code in small reusable modules in order to maintain an organised and structured code base. But on the production server you want to minify the number of HTTP requests to improve the overall loading time of your page. In this post we discuss this subject in detail and come up with some tools you can use to achieve this result.

Read more

Styling fonts with jQuery: a tutorial

Posted in Javascript on September 4, 2015

Recently we showed some CSS font properties. Sure CSS3 can achieve a whole lot and it is often better for performance of your site to achieve as much as you need with CSS only, but there are a lot of funny jQuery plugins and today I like to show you some examples of these as well.

Read more