Skip to content

Commit 266ca97

Browse files
committed
Add modules to handle importing batchedUpdates
1 parent af0c3a7 commit 266ca97

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/utils/batch.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Default to a dummy "batch" implementation that just runs the callback
2+
function defaultNoopBatch(callback) {
3+
callback()
4+
}
5+
6+
let batch = defaultNoopBatch
7+
8+
// Allow injecting another batching function later
9+
export const setBatch = newBatch => (batch = newBatch)
10+
11+
// Supply a getter just to skip dealing with ESM bindings
12+
export const getBatch = () => batch

src/utils/reactBatchedUpdates.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* eslint-disable import/no-unresolved */
2+
export { unstable_batchedUpdates } from 'react-dom'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-disable import/no-unresolved */
2+
import { unstable_batchedUpdates } from 'react-native'
3+
4+
export { unstable_batchedUpdates }

0 commit comments

Comments
 (0)