Skip to content

Commit cf6d0b5

Browse files
committed
Formatting
1 parent 8f2e4c4 commit cf6d0b5

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

docs/api/connect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ export default connect(
571571
572572
The number of declared function parameters of `mapStateToProps` and `mapDispatchToProps` determines whether they receive `ownProps`
573573
574-
> Note: `ownProps` is not passed to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument. If the incoming value of `ownProps` is `undefined`, the default argument value will be used.
574+
> Note: `ownProps` is not passed to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument. If the incoming value of `ownProps` is `undefined`, the default argument value will be used.
575575
576576
```js
577577
function mapStateToProps(state) {

docs/api/hooks.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ React Redux now offers a set of hook APIs as an alternative to the existing `con
1313

1414
These hooks were first added in v7.1.0.
1515

16-
1716
## Using Hooks in a React Redux App
1817

1918
As with `connect()`, you should start by wrapping your entire application in a `<Provider>` component to make the store available throughout the component tree:
@@ -212,10 +211,6 @@ export const App = () => {
212211

213212
## Removed: `useActions()`
214213

215-
216-
217-
218-
219214
## `useDispatch()`
220215

221216
```js
@@ -295,7 +290,6 @@ export const CounterComponent = ({ value }) => {
295290
}
296291
```
297292

298-
299293
## Custom context
300294

301295
The `<Provider>` component allows you to specify an alternate context via the `context` prop. This is useful if you're building a complex reusable component, and you don't want your store to collide with any Redux store your consumers' applications might use.
@@ -395,7 +389,7 @@ This hook was in our original alpha release, but removed in `v7.1.0-alpha.4`, ba
395389
That suggestion was based on "binding action creators" not being as useful in a hooks-based use case, and causing too
396390
much conceptual overhead and syntactic complexity.
397391

398-
You should probably prefer to call the [`useDispatch`](#usedispatch) hook in your components to retrieve a reference to `dispatch`,
392+
You should probably prefer to call the [`useDispatch`](#usedispatch) hook in your components to retrieve a reference to `dispatch`,
399393
and manually call `dispatch(someActionCreator())` in callbacks and effects as needed. You may also use the Redux
400394
[`bindActionCreators`](https://redux.js.org/api/bindactioncreators) function in your own code to bind action creators,
401395
or "manually" bind them like `const boundAddTodo = (text) => dispatch(addTodo(text))`.
@@ -410,12 +404,15 @@ import { useMemo } from 'react'
410404

411405
export function useActions(actions, deps) {
412406
const dispatch = useDispatch()
413-
return useMemo(() => {
414-
if (Array.isArray(actions)) {
415-
return actions.map(a => bindActionCreators(a, dispatch))
416-
}
417-
return bindActionCreators(actions, dispatch)
418-
}, deps ? [dispatch, ...deps] : [dispatch])
407+
return useMemo(
408+
() => {
409+
if (Array.isArray(actions)) {
410+
return actions.map(a => bindActionCreators(a, dispatch))
411+
}
412+
return bindActionCreators(actions, dispatch)
413+
},
414+
deps ? [dispatch, ...deps] : [dispatch]
415+
)
419416
}
420417
```
421418

docs/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ Or by setting it globally:
118118
}
119119
```
120120

121-
See https://github.com/facebook/react/issues/14927#issuecomment-490426131
121+
See https://github.com/facebook/react/issues/14927#issuecomment-490426131

0 commit comments

Comments
 (0)