Using TypeScript ADT’s to write more reliable React

You may have heard of Algebraic Data Types (ADT’s) before but didn’t understand how they can be applied to everyday code - so this article will provide some examples and explanations of why you should start using them.

Before we get into ADT’s, let’s go over the foundation of what ADT’s are made of.

Basic Types

In Javascript, you can not declare a type that prevents other types from being assigned to it. The below example we see that anything can be assigned to the language variable. We can assign a number or a boolean or an object to it if we later wanted, but that may cause bugs in the future if we were not expecting the variable type to be something other than a string.

Read more →

Comparing Elm to React/Redux

I have recently been exploring creating web apps in Elm and found it to be a breath of fresh air compared to the usual React/Redux projects I have worked on in the past.

*Disclaimer: I still think React/Redux is great and viable for large teams if done correctly. This article will just explain my pain points with it while working on large teams at various companies, and why I think Elm can be a better alternative in some cases.

Read more →