Why component store is a great default for state management in Angular

preview_player
Показать описание

In this video, we walk through how to use @ngrx/component-store to manage local state in an Angular application. We use an example application from a previous video that needs to manage login form state.

0:00 Introduction
0:51 Some context
1:37 What does component store do?
4:13 Reading state
6:10 Writing state
11:28 Benefits

#ionic #angular #ngrx

Рекомендации по теме
Комментарии
Автор

Just implemented multiple component stores at my job and I gotta say I'm a fan. There isnt as much boiler plate code like there is with full ngrx/store and writing unit tests for them was a breeze...dare I say I actually had fun writing the tests. Great video Josh!

DavidSchmidt
Автор

Thanks a lot, looking forward for the video with providing component store directly to the component!

yevheniiherasymchuk
Автор

Any thoughts on component store vs rx-angular/state? Both address the same use case but with some api differences.

harleybussell
Автор

Can you share examples projects using ngrx store and component store

balajeebala
Автор

Would you recommend keeping Form Controls in the component or moving them to the component store?

MrZhunio
Автор

Great tutorial so far, thank you a lot, I have a question, on this video you showed how to use ngrx component store, what happen if we use smart and dumb component with it ? with smart dumb normally we should not include any service, right ? does this mean that we need to use inputs and outputs ? for global store it is no an issue because only the smart component will handle the connection to store and then will pass these data through input, but for smaller store (component store) this will remove any advantage of using it. waiting for your reply

djamio
Автор

Hey Josh, can we set componentStore as providedin root, is that a good practice to follow ?

balajibalamurugan
Автор

I don't like that you inject the componentstore into the child components. Only reason is that they are no longer reusable. I would still just stick to smart/dumb components and just use inputs and outputs and let the parent component using the store do the subscribing to the state with async pipes the the child component. Leaving it the smart component with a store.

HenrikBgelundLavstsen