Skip to content

Commit e228b32

Browse files
aminsoheylitimdorr
authored andcommitted
add a line to insist on the pure nature (#1386)
* add a line to insist on the pure nature add a line to insist on the pure nature of mapStateToProps function * Reorder
1 parent 65d7935 commit e228b32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ As part of the "re-shaping data" idea, `mapStateToProps` functions frequently ne
112112
113113
### `mapStateToProps` Functions Should Be Pure and Synchronous
114114
115-
Much like a Redux reducer, a `mapStateToProps` function should always be 100% pure and synchronous. It should simply take `state` (and `ownProps`) as arguments, and return the data the component needs as props. It should _not_ be used to trigger asynchronous behavior like AJAX calls for data fetching, and the functions should not be declared as `async`.
115+
Much like a Redux reducer, a `mapStateToProps` function should always be 100% pure and synchronous. It should only take `state` (and `ownProps`) as arguments, and return the data the component needs as props without mutating those arguments. It should _not_ be used to trigger asynchronous behavior like AJAX calls for data fetching, and the functions should not be declared as `async`.
116116
117117
## `mapStateToProps` and Performance
118118

0 commit comments

Comments
 (0)