platform
platform copied to clipboard
ComponentStore: updater() Read docs seems off.
Information
Docs says I should write it like this.. but This doesn't seem to work properly.
readonly addMovie = this.updater((state, movie: Movie) => ({
movies: [...state.movies, movie],
}));
It only works when I write it like this, and I just want to confirm whether I'm doing it right or wrong:
readonly addMovie = this.updater((state, movie: Movie) => ({
...state,
movies: [...state.movies, movie],
}));
sorry for bnothering...
Documentation page
https://ngrx.io/guide/component-store/write
I would be willing to submit a PR to fix this issue
- [ ] Yes
- [x] No
What's the error that you're experiencing? The example should be fine because the state only consists of the movies property.