O'Reilly logo

React 16 Tooling by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Removing runtime checks

The solution to handling data with unknown types in dynamic languages such as JavaScript is to check values at runtime. Depending on the type of value, you might have to perform some alternate action to get the value that your code is expecting. For example, a common idiom in JavaScript is to make sure that a value is neither undefined or null. If it is, then we either throw an error or provide a default value.

When you perform runtime checks, it changes the way you think about your code. Once you start performing these checks, they inevitably evolve into more elaborate checks and more of them. This frame of mind really amounts to not trusting yourself or others to call code with the correct data. You think since it's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required