Generally you would do `foo?.bar?.baz || 1337`, unless `baz` was expected to sometimes have a significant falsy value.
I've talked about an idea to introduce `??` (from C#, null coalescing operator), which provides default values for undefined case only (not all of falsy), with which `foo?.bar?.baz ?? 1337` would be equivalent to the top line in your code.
Also worth noting that the article doesn't address the benefits listed in a link he provides near the end, namely:
- It helps keep the naming consistent because all action types are gathered in a single place.
- Sometimes you want to see all existing actions before working on a new feature. It may be that the action you need was already added by somebody on the team, but you didn’t know.
- The list of action types that were added, removed, and changed in a Pull Request helps everyone on the team keep track of scope and implementation of new features.
- If you make a typo when importing an action constant, you will get undefined. This is much easier to notice than a typo when you wonder why nothing happens when the action is dispatched.