Angular 2 Game Of States.txt - What is State State is a snapshot of the application at any certain point of time For example the current state of an

Angular 2 Game Of States.txt - What is State State is a...

This preview shows page 1 - 3 out of 9 pages.

What is State? What is the active route in a website? As the application grows, how do you know that a state change in one module willconsistently and accurately reflect in other modules? State Management in Angular 2 As it is evident from the image, Redux is inspired from Flux and Ngrx is inspired from Redux. There are two popular ways to implement State Management in Angular 2: Using RxJS - @ngrx/store Using Redux - ng2-redux We will be using @ngrx/store in this course. What is @ngrx/store? @ngrx/store, powered by RxJS, is a State Management Library especially designed for Angular 2 to deliver consistent and performant applications. It is inspired by Redux: Single store Unidirectional data flow Immutability Action and others that control the view. Main Parts of State Management Any application implementing state management will have following items: Store Action Reducers State Understanding Items Of States Let us understand each item in detail considering an example of Counter App. The app will have some initial state (State 1) User interaction with application generates actions like INCREMENT / DECREMENT that increases or decreases the count Depending on the action type, reducer updates the store with state 2 or state 3 That updated store changes users view
Image of page 1
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 9 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture