Member-only story
Component-First State Management for Angular Standalone Components
Introduction
In 2021, Angular announced an RFC (Request For Comments) for Standalone Components. Optional NgModules
have been a frequent ask from the framework's community since their introduction in Angular 2-rc.5. Standalone Components (and Directives and Pipes) are Angular's answer to this request. It paves the way for our Angular apps to be built purely with Components.
However, over the years we have built architectural patterns for Angular taking into account that NgModules
exist and are the driving force of current Angular apps. With NgModules
becoming optional, we need to think about new patterns that can help us to build the same resilient and scalable apps, but using a simpler mental model of our apps.
This is where Component-First comes into play. It is a collection of patterns for designing Angular apps, once we have Standalone Components, that emphasises that Components, as the main source of user interaction, are the source of truth for our apps.
We should be able to link all the components in our app together and know exactly how our app works.
There’ll be no magic happening off in some obscure module somewhere.