Developer bit

๐Ÿ‘‹ Hello @ngrx/signals

Exciting news for Angular developers!

๐Ÿ‘‹ Hello @ngrx/signals

Exciting news for Angular developers!

With the release of Angular Signals, the NgRx team - especially Marko Stanimiroviฤ‡ who came up with the idea and did the heavy lifting - built a new state management solution that provides a reactive state management solution and a set of utilities for Angular Signals.

@ngrx/signals consists of two big blocks and includes multiple smaller convenient Lego blocks to make working with state simple and intuitive.

  • The signalState utility method provides a lightweight solution that manages state in a concise and minimalistic manner;
  • While signalStoreprovides a full-blown state management solution (with optional plugins, e.g. Entity Management);

These tools provide an opinionated, but flexible, development experience to build your application.

Check out the v17 blog post for more info, or the in-depth blog posts from the Angular Architects team!

counter.component.ts
import { Component } from '@angular/core';
import { signalState, patchState } from '@ngrx/signals';
@Component({
selector: 'app-counter',
standalone: true,
template: `
Count: {{ state.count() }}
<button (click)="increment()">Increment</button>
<button (click)="decrement()">Decrement</button>
<button (click)="reset()">Reset</button>
`,
})
export class CounterComponent {
state = signalState({ count: 0 });
increment() {
patchState(this.state, (state) => ({ count: state.count + 1 }));
}
decrement() {
patchState(this.state, (state) => ({ count: state.count - 1 }));
}
reset() {
patchState(this.state, { count: 0 });
}
}

Feel free to update this developer bit on GitHub, thanks in advance!

Enjoying the blog?

Support my work

If you enjoyed this post and found it useful, consider supporting my work. It helps me keep creating and sharing content like this. Thank you!