Angular
  • Introduction
  • Angular Command
  • Oshop Project
    • Oshop Tips
    • Product Management Module
  • Redux
  • Angular Tips
    • Communicate with Angular components outside of Angular
    • Safe Pipe
    • Highlight attachment file
    • Set CSS background-image value in Angular
  • Angular DatePicker Tips
  • Angular 6 Breadcrumb
Powered by GitBook
On this page
  • Waht's Redux
  • Benefits
  • When to use Redux
  • Building Block
  • The Store
  • Actions
  • Reducer

Was this helpful?

Redux

Waht's Redux

A library that helps you manage the state of your application

Benefits

  • Predicatable application state

  • Decoupled architecture

  • Testability

  • Great tooling

  • Undo/Redo

When to use Redux

  • Independent copies of the same data in multiple places

  • Multiple views that need to work with the same data and be in sync

  • Data can be updated by multiple users

  • Data can be updated by multiple actors

Building Block

The Store

A single JS object that contains the state of the application (like local client-side database)

Actions

Plain JS object that represent something that has happened. (more like an Events)

{type: 'MARKS_AS_READ'}
{type: 'POST_MESSAGE', body: '...'}

Reducer

A function that specifies how that state changes in response to an action (like event handler)

A reducer does not modify the state, It returns the new state

PreviousProduct Management ModuleNextCommunicate with Angular components outside of Angular

Last updated 5 years ago

Was this helpful?