Skip to content

Commit

Permalink
fix broken link in hooks.md (#1465)
Browse files Browse the repository at this point in the history
* fix broken link in hooks.md

* use relative path & redirected target

* update link in website/versioned
- remove extra whitespace

* Update hooks.md

* Update hooks.md
  • Loading branch information
thiskevinwang authored and timdorr committed Dec 6, 2019
1 parent 24354a6 commit 5bef286
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/api/hooks.md
Expand Up @@ -40,7 +40,7 @@ Allows you to extract data from the Redux store state, using a selector function

> **Note**: The selector function should be [pure](https://en.wikipedia.org/wiki/Pure_function) since it is potentially executed multiple times and at arbitrary points in time.
The selector is approximately equivalent to the [`mapStateToProps` argument to `connect`](using-react-redux/connect-extracting-data-with-mapStateToProps.md) conceptually. The selector will be called with the entire Redux store state as its only argument. The selector will be run whenever the function component renders. `useSelector()` will also subscribe to the Redux store, and run your selector whenever an action is dispatched.
The selector is approximately equivalent to the [`mapStateToProps` argument to `connect`](../using-react-redux/connect-extracting-data-with-mapStateToProps.md) conceptually. The selector will be called with the entire Redux store state as its only argument. The selector will be run whenever the function component renders. `useSelector()` will also subscribe to the Redux store, and run your selector whenever an action is dispatched.

However, there are some differences between the selectors passed to `useSelector()` and a `mapState` function:

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-7.1/api/hooks.md
Expand Up @@ -41,7 +41,7 @@ Allows you to extract data from the Redux store state, using a selector function

> **Note**: The selector function should be [pure](https://en.wikipedia.org/wiki/Pure_function) since it is potentially executed multiple times and at arbitrary points in time.
The selector is approximately equivalent to the [`mapStateToProps` argument to `connect`](using-react-redux/connect-extracting-data-with-mapStateToProps.md) conceptually. The selector will be called with the entire Redux store state as its only argument. The selector will be run whenever the function component renders. `useSelector()` will also subscribe to the Redux store, and run your selector whenever an action is dispatched.
The selector is approximately equivalent to the [`mapStateToProps` argument to `connect`](../using-react-redux/connect-extracting-data-with-mapStateToProps.md) conceptually. The selector will be called with the entire Redux store state as its only argument. The selector will be run whenever the function component renders. `useSelector()` will also subscribe to the Redux store, and run your selector whenever an action is dispatched.

However, there are some differences between the selectors passed to `useSelector()` and a `mapState` function:

Expand Down Expand Up @@ -355,7 +355,7 @@ This hook was in our original alpha release, but removed in `v7.1.0-alpha.4`, ba
That suggestion was based on "binding action creators" not being as useful in a hooks-based use case, and causing too
much conceptual overhead and syntactic complexity.

You should probably prefer to call the [`useDispatch`](#usedispatch) hook in your components to retrieve a reference to `dispatch`,
You should probably prefer to call the [`useDispatch`](#usedispatch) hook in your components to retrieve a reference to `dispatch`,
and manually call `dispatch(someActionCreator())` in callbacks and effects as needed. You may also use the Redux
[`bindActionCreators`](https://redux.js.org/api/bindactioncreators) function in your own code to bind action creators,
or "manually" bind them like `const boundAddTodo = (text) => dispatch(addTodo(text))`.
Expand Down

0 comments on commit 5bef286

Please sign in to comment.