You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where selector is a function taking for single argument the entire redux Store's state (a plain JS object) and returns another object, which is the slice of the state that your component is interested in.
19
+
e.g:
20
+
```JS
21
+
state=>state.todos
22
+
```
23
+
Note: if you are not familiar with this syntax, go and check out the [MDN Guide on fat arrow functions (ES2015)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
24
+
25
+
If you haven't, check out [reselect](https://github.com/faassen/reselect), an awesome tool to create and combine selectors.
26
+
27
+
28
+
This returned object will be passed as argument to the callback provided whenever the state changes.
29
+
ngRedux checks for shallow equality of the state's selected slice whenever the Store is updated, and will call the callback only if there is a change.
30
+
##### Important: It is assumed that you never mutate your states, if you do mutate them, ng-redux will not execute the callback properly.
31
+
See [Redux's doc](http://gaearon.github.io/redux/docs/basics/Reducers.html) to understand why you should not mutate your states.
32
+
If you have a good reason to mutate your states, you can still [disable caching](#Disable-caching) altogether.
33
+
34
+
35
+
## Getting Started
36
+
37
+
#### Initialization
38
+
You need to pass Redux Store to ng-redux via ```$ngReduxProvider``` :
Each time Redux's Store update, ng-redux will check if the slices specified via 'selectors' have changed, and if so will execute the provided callback.
101
+
You can disable this behaviour, and force the callback to be executed even if the slices didn't change by setting ```disableCaching``` to true:
0 commit comments