Managing State in Angular 2 - St Louis Angular Lunch - Kyle Cordes

By: Oasis Digital Solutions Inc.

51   1   3871

Uploaded on 10/20/2016

Comments (4):

By anonymous    2017-09-20

This is much depends on your use-case for each Component whether how many @Output and @Input they have.

I have been using your 1st-approach for quite a time and it seems to be fine if your Child / lower-order component does very simple interaction ( take data top-down , then emit an Event back to Parent ) or a Dumb Component ( only takes Input ) . Sure that my Container was very big

But if one of your Child components ended up having many I/O and having many other child-child components which also having the same, you might want to treat them as a Big-Child ( @Output() from Child will stay in Big-Child component instead of passed to GrandParent component )

Having too much @Output() from bottom-up might give you headache as well :) . 2nd-approach would make your Component easier to read.

AppComponent |-- ContainerComponent |-- ChildComponent1 | |-- GrandChildComponent | |-- GrandGrandChildComponent |-- ChildComponentWithManyIO => Make them to be self-managed |--GrandChild with only Input |--GrandChild with many Inputs/Outputs ( Self-managed )

My idea of managing states came up from here : https://www.youtube.com/watch?v=eBLTz8QRg4Q

Original Thread

By anonymous    2017-09-20

I think you have to think more in terms of MVC vs CBA(component based architecture) rather than Redux vs MVC.

Redux helps you synchronize state between your components and really shines when you got complex component trees that share state.

I would like to point you to this excellent presentation that may help you understand the benefits of using Redux in a component based architecture.

Managing State in Angular 2 - St Louis Angular Lunch - Kyle Cordes https://youtu.be/eBLTz8QRg4Q

Original Thread

Submit Your Video

If you have some great dev videos to share, please fill out this form.