{
type: 'INCREMENT',
value: 1
}
KASSEM Passam
RxJS powered state management for Angular applications, inspired by Redux
The state of your whole application is stored in an object tree within a single store.
ONE STORE TO SAVE THEM ALL
ONE STORE TO FIND THEM
ONE STORE TO BRING THEM ALL
The only way to change the state is to emit an action.
Action : an object describing what happened.
{
type: 'INCREMENT',
value: 1
}
To specify how the state tree is transformed by actions, you write pure reducers.
(previousState, action) ⇒ newState
(1, INCREMENT) ⇒ 2
Prerequisites : angular (2+) application
npm install --save @ngrx/store
Browser extension : Redux DevTools
npm install --save @ngrx/store-devtools
@ngrx/effects provides an API to model event sources as actions
npm install --save @ngrx/effects
[{
"id": 1,
"title": "First Article",
"author": {
"id": 1,
"name": "David"
}
}, {
"id": 2,
"title": "Second Article",
"author": {
"id": 1,
"name": "David"
}
}]
{
"articles": [{
"id": 1,
"title": "First Article",
"author": 1
},
{
"id": 2,
"title": "Second Article",
"author": 1
}
],
"authors": [{
"id": 1,
"name": "David"
}]
}
Makes it easier to structure a big application
Gain in performance by Normalizr your store
Awesome debugger extension
Take a long time to learn
Convince people with Ngrx