Skip to content

Commit 3f0933c

Browse files
committed
Update docs versioning for 7.1
1 parent 316467a commit 3f0933c

File tree

14 files changed

+1284
-23
lines changed

14 files changed

+1284
-23
lines changed

website/siteConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const siteConfig = {
108108
* After that, 7.x will no longer appear in "pre-release" versions and we should remove this line
109109
* More info: https://docusaurus.io/docs/en/versioning
110110
*/
111-
nextVersion: '7.1.0-alpha.5',
111+
nextVersion: '',
112112

113113
gaTrackingId: 'UA-130598673-2'
114114
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: version-7.1-batch
3+
title: batch
4+
sidebar_label: batch()
5+
hide_title: true
6+
original_id: batch
7+
---
8+
9+
# `batch()`
10+
11+
```js
12+
batch(fn: Function)
13+
```
14+
15+
React's `unstable_batchedUpdate()` API allows any React updates in an event loop tick to be batched together into a single render pass. React already uses this internally for its own event handler callbacks. This API is actually part of the renderer packages like ReactDOM and React Native, not the React core itself.
16+
17+
Since React-Redux needs to work in both ReactDOM and React Native environments, we've taken care of importing this API from the correct renderer at build time for our own use. We also now re-export this function publicly ourselves, renamed to `batch()`. You can use it to ensure that multiple actions dispatched outside of React only result in a single render update, like this:
18+
19+
```js
20+
import { batch } from 'react-redux'
21+
22+
function myThunk() {
23+
return (dispatch, getState) => {
24+
// should only result in one combined re-render, not two
25+
batch(() => {
26+
dispatch(increment())
27+
dispatch(increment())
28+
})
29+
}
30+
}
31+
```
32+
33+
## References
34+
35+
- [`unstable_batchedUpdate()` API from React](https://github.com/facebook/react/commit/b41883fc708cd24d77dcaa767cde814b50b457fe)

0 commit comments

Comments
 (0)