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
+24-58Lines changed: 24 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,9 @@ React Redux now offers a set of hook APIs as an alternative to the existing `con
13
13
14
14
> **Note**: The hook APIs listed in this page are **still experimental and in alpha!** We encourage you to try them out in your applications and give feedback, but be aware that they may be changed before a final release, including potential renaming or removal.
15
15
16
-
This page reflects the latest alpha, which is currently **v7.1.0-alpha.3**.
16
+
These hooks were first added in v7.1.0.
17
+
18
+
This page reflects the latest alpha, which is currently **v7.1.0-alpha.4**.
Allows you to prepare bound action creators that will dispatch actions to the Redux store when called.
94
-
95
-
This is conceptually similar to the [`mapDispatchToProps` argument to `connect`](../using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md). The action creators that are passed in will be bound using the Redux [`bindActionCreators()` utility](https://redux.js.org/api/bindactioncreators), and the bound functions will be returned.
96
-
97
-
However, there are some differences between the arguments passed to `useActions()` and the `mapDispatch` argument to `connect()`:
98
-
99
-
-`mapDispatch` may be either a function or an object. `useActions()` accepts a single action creator, an object full of action creators, or an array of action creators, and the return value will be the same form.
100
-
-`mapDispatch` is normally used once when the component is instantiated, unless it is a function with the `(dispatch, ownProps)` signature, which causes it to be called any time the props have changed. The action creators passed to `useActions()` will be re-bound (and thus have new function references) whenever the values passed in the `deps` array change. If no `deps` array is provided, the functions will be re-bound every time the component re-renders.
101
-
102
-
> **Note**: There are potential edge cases with using the object argument form and declaring the object inline. See the [Usage Warnings](#usage-warnings) section of this page for further details.
103
-
104
-
You may call `useActions()` multiple times in a single component.
105
-
106
-
#### Examples
107
-
108
-
```jsx
109
-
importReactfrom'react'
110
-
import { useActions } from'react-redux'
85
+
## Removed: `useActions()`
111
86
112
-
constincreaseCounter=amount=> ({
113
-
type:'increase-counter',
114
-
amount
115
-
})
87
+
This hook was removed in `v7.1.0-alpha.4`, based on [Dan Abramov's suggestion](https://github.com/reduxjs/react-redux/issues/1252#issuecomment-488160930).
88
+
That suggestion was based on "binding action creators" not being as useful in a hooks-based use case, and causing too
89
+
much conceptual overhead and syntactic complexity.
0 commit comments