Skip to content

Commit

Permalink
update connect docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jspurlin committed Aug 31, 2022
1 parent a397801 commit 0846e26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/api/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ connect(mapStateToProps, mapDispatchToProps, null, { context: MyContext })(
)
```
#### `areStatesEqual: (next: Object, prev: Object) => boolean`
#### `areStatesEqual: (next: Object, prev: Object, nextOwnProps: Object, prevOwnProps: Object) => boolean`
- default value: `strictEqual: (next, prev) => prev === next`
Expand All @@ -244,7 +244,7 @@ const areStatesEqual = (next, prev) =>
prev.entities.todos === next.entities.todos
```
You may wish to override `areStatesEqual` if your `mapStateToProps` function is computationally expensive and is also only concerned with a small slice of your state. The example above will effectively ignore state changes for everything but that slice of state.
You may wish to override `areStatesEqual` if your `mapStateToProps` function is computationally expensive and is also only concerned with a small slice of your state. The example above will effectively ignore state changes for everything but that slice of state. Additionally, `areStatesEqual` provides `nextOwnProps` and `prevOwnProps` to allow for more effective scoping of your state which your connected component is interested in, if needed.
This would likely impact the other equality checks as well, depending on your `mapStateToProps` function.
Expand Down

0 comments on commit 0846e26

Please sign in to comment.