Tag Archives: Functional Programming

Code Review: Fixing Unexpected State

During code review I came across a function that could produce broken state for a component. I wrote up an example Gist to show how it could create an unexpected state and a way to adopt the functional programing concept of “not mutating external state” to avoid this broken state.

Now you might think this would never happen to you because you wouldn’t catch the exception like my example and it would be an easy bug to find and fix, but remember Promises behave like Try/Catch.