Home

Boolean Trap

Gunar Gessner

Gunar Gessner

Apr 28, 2020

The boolean trap is a place we get to when we write functions that take boolean values as arguments. Boolean traps increase accidental complexity and can lead to impossible scenarios such as a button being both primary and secondary at the same time:

<Button primary secondary>
  Primary or Secondary?
</Button>

To avoid it, do this instead:

<Button variant="primary">
  Obviously primary!
</Button>

Sign up for the newsletter


Read other stuff