Web Development

Why does React state need a new object/array?

Why does React state need a new object/array?

  • May 25, 2021

If you have been using React for a while, you are familiar with how state update works. There are a lot of internal optimizations that React makes for faster rendering. One of the implementation details of the React internals is that it checks whether the given state object has actually...

Using utility types for transforming TypeScript types

Using utility types for transforming TypeScript types

  • May 20, 2021

TypeScript provides some built-in utility types that help facilitate transformations of types from one form to another. These utilities are available globally. They can be quite handy in various situations. TypeScript generics Before understanding the TypeScript utility types, it is important to understand type aliases and generics. You can create...

TypeScript: the difference between interface and type

TypeScript: the difference between interface and type

  • May 13, 2021

Once we start exploring TypeScript, we start using interfaces and types without really understanding the differences between them. I am guilty of doing that as well. It is simple to get started with them and keep using them. But, at some point, it becomes important to know the difference between...

Writing better conditional expressions in JavaScript

Writing better conditional expressions in JavaScript

  • March 30, 2021

Writing conditional expressions is pretty easy to do. But there is room for improvement in the way we have been doing it. And with the flexibility that JavaScript provides, we can replace conditionals with clean code by using some good practices. And it can lead to more maintainable code. Let...

Parsing and validating data in Python using Pydantic

Parsing and validating data in Python using Pydantic

  • March 23, 2021

The introduction of type hinting opened the gates for many great new features in Python. And data validation and parsing became easier to do with the use of type hints. Pydantic is one such package that enforces type hints at runtime. It throws errors, allowing developers to catch invalid data....

Using the optional chaining operator in JavaScript

Using the optional chaining operator in JavaScript

  • March 18, 2021

Every now and then, you come across a JavaScript feature that vastly changes the way you write it. Destructuring, arrow functions, modules have been some of those features for me. Optional chaining is going to be the next one on that list for me. Optional Chaining is in stage 4...

Statically type checking Python code using Pyright

Statically type checking Python code using Pyright

  • March 16, 2021

With the introduction of type hinting in Python 3.5, static typing and checking Python codes has started to gain popularity. While MyPy was the first tool to do static type checking of Python code, many other frameworks have been built after it. Pyright is one such tool built by Microsoft...

Adding fixtures and parameterized functions to PyTest

Adding fixtures and parameterized functions to PyTest

  • March 11, 2021

As we discussed in our post on getting started with Pytest, the framework allows us to reuse tests by using test fixtures and parameterized functions. In this post, we will learn how to do so. We will build on the simple calculator example that we discussed in the previous post...