Sign in

Zealous Engineer — TypeScript & Tech Leadership — Speaks — Loves maths — Reads specs — Vzhurudolu.cz podcast — Lives in Berlin

So many times I have seen developers use the index of an item as its key when they render a list.

todos.map((todo, index) => (
<Todo {...todo} key={index} />
));
}

It looks elegant and it does get rid of the warning (which was the ‘real’ issue, right?). What is the danger here?

It may break your application and display wrong data!

Let me explain, a key is the only thing React uses to identify DOM elements. What happens if you push an item to the list or remove something in the middle? If the key is same as before…


Since the very first moment I learned about TypeScript, I knew there’s gonna be this one thing I’ll always hate: Enums. So un-elegant, so old-school, and so why-do-you-pollute-my-runtime.

Well, I was wrong. I use Enums now. At least some of them.

Let me show you.

What is an Enum in TypeScript?

First, let’s quickly talk about what are Enumerators, or Enums for short.

An Enum in TypeScript is a well-defined collection of a limited number of cases. That is, we write down all possibilities and do not allow anything else.

The meaning of enumerations is that in the code you deal with only these few cases…


Photo by Marvin Meyer on Unsplash

Recently I was re-reading one of my favorite engineering articles The Trident Model of Career Development by Patrick Kua. The sentence that caught my eye this time was a note about the role of a Tech Lead:

They should have good but not necessarily the best [tech] skills in the team they are leading.

‘How does this apply to an Engineering Manager?’ came to my mind instantly. And my initial response was that it’s the same. Yet, after some more thought and thinking about the Engineering Managers I’ve met, I was not sure. Then I made my mind: no, it’s…


This is a simple tutorial for embedding a YouTube channel into an AMP. With a small modification, this can be used for any website.

A YouTube home page on a laptop. Photo by Leon Bublitz.

I recently started a YouTube channel about JavaScript. To promote it I wanted to embed the latest video on my home page. It is easy, but it is not straightforward.

1. Embedding single video is easy

When you want to embed a single video, it is super easy. There is a share button which will display the HTML code. Technically it is an iframe with URL in the form youtube.com/embed/W056nRs4IS8. That W056nRs4IS8 is called video id (the part after youtube.com/watch?v=).

In AMP…


This article is a reply to stefan judis's article How the rest operator and default values affect the function length property.

Stefan shows how a function length is computed when it includes a rest parameter or parameters with a default value.

A quick summary:

const fn1 = (a    , b    ) => { }
const fn2 = (a , ...b ) => { }
const fn3 = (a , b = 2) => { }
const fn4 = (a = 1, b ) => { }
fn1.length // -> 2
fn2.length // -> 1
fn3.length // -> 1
fn4.length …


Koa is a species of tree on Hawaii (not pictured). Photo by Ozark Drones.

Simplify API and middleware tests with lesser-known features

This is a transcript of a presentation given at October Node.js Berlin Meetup.

What is Koa and what is Jest

Let's briefly describe the libraries we will be working with.

Koa (koajs.com) is a JavaScript web server framework. It was developed by the people behind a more famous Express as a lightweight and expressive ‘spiritual successor.’

It, too, is middleware based. However, it comes bundled with none. Yes, no router, no body parser, and no proxy. Utilising ES2017 async/await functions brings user-friendly functions and end-to-end flow control. (Are you not familiar with async/await? Read this helpful intro by Mostafa Gaafar. We will use them a lot.) That…


A shadow over our clean, elegant code? Photo by Benjamin Bousquet

Recently I got into a discussion about how to decide a function is pure in JavaScript. The whole concept of pureness seems to be blurry in such a dynamic language. The following examples show we might need to redefine the term ‘pure function’, or — at least–be very careful when we decide on it.

What is a pure function

If you are new to this term I recommend you first read some introduction. The Definition of “Pure Function” by Alvin Alexander and Master the JavaScript Interview: What is a Pure Function? by Eric Elliott are excellent choices.

To sum up, a function is called pure…


Recently we were implementing a feature in our app that resulted in a nice kata-like task, encouraging me to play with JavaScript Promises and deepening my knowledge of them.

Illustration of Autocomplete by Martin Bonov

The task:

For an autocomplete there are several services to ask for suggestions on user input. Those services are ordered from our own servers (cheap), to partners', to Google's (expensive). We want to show the user the first non-empty response. Moreover, we want to ask the next service only if the previous service suggested no items.

Oh, and one part that resembled the kata, too, was that I had a lot…


Behold my complete collection. Taken mostly in Berlin.

Uff, today I posted the 100th photo of an abandoned bike and hence finished my 100-day project.

Closing with the bike I passed by the most, it is even visible on the day 4 photo!

Inspired by Jirka's post last year, I'd like to summarize what it has been like. Indeed, it was different to what I had imagined.

There are hundreds of abandoned bikes (in Berlin)

At the beginning I knew less than a dozen potential abandoned bikes. Those were usually along my way to work. …


I started noticing abandoned bikes 6 months ago. See on Instagram.

Today I am starting my first 100 days project.

For the next 100 days I will be posting photos of an abandoned bike to my Instagram account. In the middle of December I will have taken, edited, and shared 100 pictures.

This is the very first photo:

Two inspirations

Last year I followed a few friends and strangers during their 100 days. It felt really nice and I promised to myself that I will join next time. To pick one project, Jirka Pénzeš's jirkovo.coffee was the most inspiring.

My older (not part of the challenge) photo that helped me decide.

Coming…

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