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
Copy file name to clipboardExpand all lines: docs/api/hooks.md
+59-5Lines changed: 59 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ From there, you may import any of the listed React Redux hooks APIs and use them
33
33
## `useSelector()`
34
34
35
35
```js
36
-
const result :any=useSelector(selector :Function, deps : any[])
36
+
const result :any=useSelector(selector :Function)
37
37
```
38
38
39
39
Allows you to extract data from the Redux store state, using a selector function.
@@ -43,7 +43,6 @@ The selector is approximately equivalent to the [`mapStateToProps` argument to `
43
43
However, there are some differences between the selectors passed to `useSelector()` and a `mapState` function:
44
44
45
45
- The selector may return any value as a result, not just an object. The return value of the selector will be used as the return value of the `useSelector()` hook.
46
-
- The selector function used will be based on the `deps` array. If no deps array is provided, the latest passed-in selector function will be used when the component renders, and also when any actions are dispatched before the next render. If a deps array is provided, the last saved selector will be used, and that selector will be overwritten whenever the deps array contents have changed.
47
46
- When an action is dispatched, `useSelector()` will do a shallow comparison of the previous selector result value and the current result value. If they are different, the component will be forced to re-render. If they are the same, they component will not re-render.
48
47
- The selector function does _not_ receive an `ownProps` argument. If you wish to use props within the selector function to determine what values to extract, you should call the React [`useMemo()`](https://reactjs.org/docs/hooks-reference.html#usememo) or [`useCallback()`](https://reactjs.org/docs/hooks-reference.html#usecallback) hooks yourself to create a version of the selector that will be re-created whenever the props it depends on change.
0 commit comments