Skip to content

Commit

Permalink
Recommend hooks over connect in redux docs
Browse files Browse the repository at this point in the history
  • Loading branch information
greglittlefield-wf committed Oct 9, 2024
1 parent 139e966 commit ba7f6bc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions doc/over_react_redux_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ A Dart wrapper for React Redux, providing targeted state updates.
- [Running the Examples](#running-the-examples)
- **[Using it in your project](#using-it-in-your-project)**
- **[ReduxProvider](#reduxprovider)**
- **[Hooks](#hooks)**
- [useSelector](#useselector)
- [useDispatch](#usedispatch)
- [useStore](#usestore)
- **[Connect](#connect)**
- [`connect` Parameters](#connect-parameters)
- [mapStateToProps](#mapstatetoprops)
Expand All @@ -22,10 +26,6 @@ A Dart wrapper for React Redux, providing targeted state updates.
- [context](#context)
- [pure](#pure)
- [forwardRef](#forwardref)
- **[Hooks](#hooks)**
- [useSelector](#useselector)
- [useDispatch](#usedispatch)
- [useStore](#usestore)
- **[Using Multiple Stores](#using-multiple-stores)**
- **[Using Redux DevTools](#using-redux-devtools)**
- [Integrating with DevTools](#integration-with-devtools)
Expand Down Expand Up @@ -168,6 +168,8 @@ A wrapper around the JS react-redux `connect` function that supports OverReact c

> See: <https://react-redux.js.org/api/connect>

> ![TIP] connect still works and is supported. However, we recommend using the hooks API as the default.

**Example:**

```dart
Expand Down Expand Up @@ -299,10 +301,18 @@ class CounterProps = UiProps with CounterPropsMixin, OtherPropsMixin;
> [More information about the `connect` function](https://react-redux.js.org/api/connect#connect)

## Hooks

OverReact exposes wrappers around React Redux hook APIs, which serve as an alternative to the existing [`connect()`](#connect) Higher Order Component.
These APIs allow you to subscribe to the Redux store and dispatch actions, without having to wrap your components
in [`connect()`](#connect).

> [!TIP]
> **We recommend using the React-Redux hooks API as the default approach in your React components.**
>
> The existing connect API still works and will continue to be supported, but the hooks API is simpler,
> requires less OverReact boilerplate, and doesn't involve suppressing validation for required props
> (see [connect](#connect) docs for more info).

> See: <https://react-redux.js.org/api/hooks>

As with [`connect()`](#connect), you should start by wrapping your entire application in a
Expand Down

0 comments on commit ba7f6bc

Please sign in to comment.