Skip to content

Commit

Permalink
feat: flushSync (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Jan 13, 2025
1 parent 667cf88 commit 7fe224a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ reconciler.injectIntoDevTools({
rendererPackageName: 'react-nil',
})

/**
* Force React to flush any updates inside the provided callback synchronously and immediately.
*/
export function flushSync<R>(fn: () => R): R {
return reconciler.flushSync(fn, undefined)
}

const container: HostContainer = { head: null }
const root = reconciler.createContainer(container, ConcurrentRoot, null, false, null, '', console.error, null)

Expand Down

0 comments on commit 7fe224a

Please sign in to comment.