RSS Amplifier

Blog

Martin Belev

Martin Belev is front end developer who specializes in JavaScript/TypeScript and React.

belev.devRSS feed ↗11 posts

Dormant Last read · last published · next check
Read 22 hours ago and current, but nothing has been published for 5 years.

Latest posts

7 tips for writing cleaner functions

Functions are one of the fundamental building blocks of our programs. It's our responsibility as developers to keep them concise, easy to understand, and reason about. Let's explore 7 language-agnostic tips that will help us to do so. Link to this heading 1. Use descriptive and intent-revealing names for your functions Don't be afraid to use long names as well. It's better than…

6 tips to improve naming and why it is so important

How would you feel when someone calls you a bad name? Choosing bad names for our variables, functions, etc. can relate to the feeling 👆. Let's explore 6 things that can help to improve our naming and why it is so important. Link to this heading 1. Intention revealing names The chosen name should answer the following questions: why it exists? what does it do? how it's used? Don't be…

How to find an old introduced bug using Git - git bisect introduction?

Want to find a bug that was introduced some time ago? We can use binary search using Git to find the culprit. How? The answer is - git bisect. Let's dive into an introduction and see how we can use it. Link to this heading Where to start from? You've seen something is broken with the latest changes on your development branch and want to find to the problem. First, you need to find an old…

Waving hand animation using pure CSS

We are going to see how to build the following emoji waving hand animation below 👇. See the Pen Waving hand by Martin Belev ( @mbelev ) on CodePen . Link to this heading Talk is cheap, show me the code 1 < div > Hey there < span class = " waving-hand " > 👋 </ span > </ div > 1 @keyframes wave { 2 0% { 3 transform : rotate ( 0 deg ) ; 4 } 5 10% { 6 transform : rotate ( 16 deg ) ; 7 } 8 20% { 9…

How to configure Git with multiple emails?

Most probably, everyone went through the simplest form of Git setup when we started using it. What I mean is configuring our username and email that is going to be used with Git. E.g. git config --global user.email "<your-email-address>" which will add a line into our .gitconfig file and it will be used throughout all of our Git repositories. This is perfect when we haven&#x27;t started a job yet…

How to keep cleaner React components with object map?

We will see one way to refactor our React components by replacing conditionals with object map. This is a favorite refactoring of mine because it makes the components easier to understand and extend, groups the logic in a single place, and requires fewer lines of code. Link to this heading Simple conditionals example A lot of times based on some input we want to display different information to…

How to use pattern matching in JavaScript - an alternative?

We are going to quickly see what is pattern matching, see basic examples of it in Scala and make an analogy with one less known usage of JavaScript switch statement. There is no native support for pattern matching in JavaScript. However, there is an open proposal which is great and it would be nice to have support and use it in the future if it gets approved and goes through all of the stages.…

How to effectively use git rebase --onto?

We are going to get a step further and explore the git rebase --onto command. What is it, how to use it to fix Git branches after rebase, how to change a branch&#x27;s base, and a bit more? We will learn those things by exploring real-world scenarios in which git rebase --onto is really useful. Let&#x27;s get started! Link to this heading Quick git rebase recap Visiting the docs , we will see the…

Some of the most used Git interactive rebase options

In the previous blog post Git merge vs rebase to keep feature branch up to date we learn about the differences between merge and rebase . If you aren&#x27;t very familiar with the basics of those commands and haven&#x27;t read it yet, it is a good idea to do so before diving into this one. The idea of this blog post is to show with examples some of the most used options of git rebase command. In…

Git merge vs rebase to keep feature branch up to date

Today we are going to look at how Git merge and rebase commands behave while trying to keep feature branch up to date. In a large codebase where a lot of people are working, we have constant updates to the master branch. We want to work on top of this branch and always have to latest changes. We can achieve this by either using merge or rebase to get the latest changes made in the master branch…

Prevent React setState on unmounted component

If you are working with React, most probably you have already seen the below issues a lot. Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op. Warning: Can&#x27;t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your…