Posts about programming:

Testing for Race Conditions with Redux
November 29, 2017
One type of error that causes bugs is race conditions. They are often hard to detect and reproduce since they only happen in special circumstances. If you’re using redux to store your state, it’s easy to write unit tests that account for these special circumstances. Let’s look at an example. The search results screen Suppose we have a long list of items which...
Why you need keys for collections in React.
July 25, 2017
Keys are important when rendering collections of items in React. They are used under the hood by React to determine what needs to be rendered or re-rendered. React does not render duplicate keys. Let’s consider this array of numbers: const nums = [1, 2, 3, 5, 2]; (Notice the duplicate value, ‘2’) Now...
Types as a convenience, Assumptions.
December 16, 2016
Minimize your assumptions with types. As developers, we make assumptions every day when we write code. I assume that a method in that library that I’m using didn’t change when I bumped the dependency’s patch version. I assume that the data I get back from /api/users is an object, not an array. I assumed that my wife wanted an honest opinion when she asked...