Kent C. Dodds 9/1/2018

Make Impossible States Impossible

Read Original

This article explains the software design principle 'Make impossible states impossible,' popularized in the Elm and React communities. It uses a practical example of an Alert component to show how using a single 'type' prop (an enum) is better than multiple boolean props, as it prevents conflicting states and makes components easier to maintain and use. The author recommends watching David Khourshid's talk on the subject and exploring the xstate library.

Make Impossible States Impossible

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet