Skip to content

Commit

Permalink
add a line to insist on the pure nature (#1386)
Browse files Browse the repository at this point in the history
* add a line to insist on the pure nature

add a line to insist on the pure nature of mapStateToProps function

* Reorder
  • Loading branch information
aminsoheyli authored and timdorr committed Aug 27, 2019
1 parent 65d7935 commit e228b32
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ As part of the "re-shaping data" idea, `mapStateToProps` functions frequently ne
### `mapStateToProps` Functions Should Be Pure and Synchronous
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`.
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`.
## `mapStateToProps` and Performance
Expand Down

0 comments on commit e228b32

Please sign in to comment.