In React, props and state are everywhere - they allow us to pass information between components and manage the output of the component over time in response to various actions. Using them separately is perfectly fine, but in some cases they are...Read more
Most of the time we learn how to write code, we memorize best practices, design patterns, clean code principles, and that's perfectly fine, but learning how not to write code is no less important. Antipatterns, just like patterns, have been around for...Read more
The useRef() is a built-in hook in React that is used for two purposes: to access DOM elements and to store mutable values that persist between component re-renders. The hook accepts an argument called initialValue and returns a mutable ref object that contains...Read more
One of the most common tasks when collaborating with other developers using Git is adding and removing commits. While adding commits is a relatively simple task, undoing incorrect or unnecessary commits can cause problems...Read more
Web applications should prevent a possibility of entering incorrect data, especially if it is such important information as email address. Email address validation is a must for all websites, not only to prevent fake data from being sent to the...Read more
Calculating mean, median, mode and range isn't a very common task, but developers definitely need to know what they are and how to calculate them based on a set of numbers. Before we proceed with the implementation, let's learn...Read more
Factorial of a number is a non-negative integer calculated as the product of all positive integers less than or equal to the number and is denoted by n!. For example: 10! = 10 \* 9 \* 8 \* 7 \* 6 \* 5 \* 4 \* 3 \* 2 * 1 = 3628800. It can be represented by the following formula...Read more
Fibonacci Sequence is a sequence of numbers in which each number is a sum of the previous two, starting with 0 and 1. The example sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc. It can be represented by the following formula...Read more
Retrieving the previous state of the component is a must in some special cases. While class-based components provide an easy and convenient way to do this via the componentDidUpdate() lifecycle hook, function components do not and you need to write custom...Read more