Photo by Christian Kaindl on Unsplash

While most Responsive Design is implemented using media queries in CSS, there are often certain parts that must be implemented using JavaScript.

Using React, this is not always as straightforward as it seems, and it’s easy to fall into the trap of using too many function calls whenever you resize your screen.

Granted, users resizing during site visits is a problem that’s a lot less common than most developers assume, so this isn’t that much of an actual problem, but I figured using this scenario is the perfect opportunity for diving a bit into creating custom React Hooks efficiently.

The…


Photo by Ferenc Almasi on Unsplash

Having recently transcended web development into the realm of smartphone development with React Native, I have encountered my fair share of alternate ways of doing already-familiar development techniques.

When making websites, although perhaps always defining margins and padding is cleaner, I often use <br /> tags for quickly defining vertical breathing space and found myself shocked to see React Native does not have this.

<br />, how did we break apart?

Turns out compensating it with something even better is quite simple! I introduce:

<Br />

That’s right. The B is capitalized. …


Photo by Minh Pham on Unsplash

In the past year, I’ve been using Firebase quite a bit, and it became my exclusive backend since February at work, meaning I’ve been using it for personal projects quite a bit as well.

For the most part, I love what they’re doing, although writing security rules can be slightly unintuitive at first, and it’s also quite easy to fall into the trap of requesting too many reads when creating subscriptions.

But there’s one issue that’s caused me a fair bit of problems in the last few days:

Email Verification

So I ran into a couple of unexpected behaviours with this that…


Photo by Adrian Swancar on Unsplash

Developers are a lazy bunch. Many were too clever in school and found they could do pretty well without doing any real effort. Others worked hard so they could get relatively safe and well-paying jobs, but once they’re in the motivation to work hard starts fading.

It doesn’t really help much that the job market is high in demand and low in supply, meaning there is very little reason to worry about job safety. …


Photo by Mukund Nair on Unsplash

Toggling on and off a set of elements is a common part of modern web services. One use-case is selecting properties to filter when searching, another would be selecting items that should be included in a request.

Writing the logic for this is usually straightforward, but a bit cumbersome to do over and over again. Having recently encountered this in a project I’m working on, I wanted to share how using a reusable hook can take care of this once and for all.

Note that this article is exclusive to React since it requires the hook API.

Ice cream shop example


Photo by engin akyurt on Unsplash

YOU!

Yes, you! I’ve got something to tell you!

Your commit messages suck!

How do I know? Well if you’re reading this article then one of your coworkers must’ve sent you here!

And guess what! Your coworker is right!

Don’t try to argue! I don’t trust your opinion anyway! How could I ever trust a developer whose commit messages suck?!

And don’t even think about complaining to your boss about intellectual harassment! Your coworker only wants to help you become better!

But before you can be helped, you must admit you have a problem!

So repeat after me:

My commit messages suck

Ok, good.


Photo by Debby Hudson on Unsplash

Recently, TypeScript 4.1 was released, and with it template literal types.

Template literal types give developers the opportunity not only to declare that a certain variable should be of type string, but it further allows developer to declare format of the string as well.

What’s the use case, and how do you implement it?

If you’re asking yourself the above question, you’re in luck! This article is meant to showcase one such example! Behold; Type Safe Date Strings!

So let’s go ahead and take a look at a possible implementation of how this can be done.

Let’s assume first that our application has two base date strings, DateYMString and DateYMDString…


Photo by Antoine Dautry on Unsplash

switch(true) is pretty much the Psyduck of Javascript; the first time you encounter it in the wild, it immediately confuses you; and it’s super effective!

But why!?

is probably what you thought when you figured out what it was doing, opting instead to use if-else clauses. I agree that it’s probably a usually better idea, but I’d like to introduce one case that definitely fits better with switch(true):

Pattern-matching action types in Redux reducers!

So this technique can be used to update the state according to action type patterns rather than matching the action type string to set values!

But why!?

is probably what you’re thinking…


Photo by Jase Bloor on Unsplash

Earlier this year, I moved from Norway to work as a web developer in the land of the rising sun 🇯🇵 . Having lived here for a few years a a student, I was already familiar with the country, but working as a web developer in a Japanese-speaking environment posed quite a few new challenges. Some concerning workplace manners, some concerning different approaches to web development best-practices, but most concerning using Japanese as a working language (web development can get quite tricky even in my native language!).

Having struggled through most of my first year, I figured I’d share common…

Lars Holdaas

Web developer working in Tokyo. Passionate about clever RxJs usage and finding creative pipes to solve problems elegantly. Currently developing www.proxjs.com

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