Skip to content

Commit 7fe224a

Browse files
feat: flushSync (#20)
1 parent 667cf88 commit 7fe224a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ reconciler.injectIntoDevTools({
103103
rendererPackageName: 'react-nil',
104104
})
105105

106+
/**
107+
* Force React to flush any updates inside the provided callback synchronously and immediately.
108+
*/
109+
export function flushSync<R>(fn: () => R): R {
110+
return reconciler.flushSync(fn, undefined)
111+
}
112+
106113
const container: HostContainer = { head: null }
107114
const root = reconciler.createContainer(container, ConcurrentRoot, null, false, null, '', console.error, null)
108115

0 commit comments

Comments
 (0)