Home

Decisions & Conditionals (Control Flow)

Managing Flow Control

All the conditions that we encouter in our code comes to "is this condition true or false?"

Reducers

We can simplify the decisions making by creating a reducer. It takes a bunch of parameters and reduces it down to give the new state.

It is an "air traffic controller" function. It's primary purpose is to delegate.

If you've seen complex code or anything within these switch statements, then that is bad. The primary role of these functions is to delegate.

The old adage of "write code that is self-documenting" came up again.

"Comments almost always go stale straight away."

Repository

https://github.com/okeeffed/developer-notes-nextjs/content/enterprise-architecture-patterns/4-decisions-and-conditionals

Sections


Related