no-flush-sync
Disallows 'flushSync'.
Full Name in eslint-plugin-react-dom
react-dom/no-flush-syncFull Name in @eslint-react/eslint-plugin
@eslint-react/dom-no-flush-syncPresets
dom
recommended
recommended-typescript
recommended-type-checked
strict
strict-typescript
strict-type-checked
Rule Details
flushSync can significantly hurt performance and may unexpectedly force pending Suspense boundaries to show their fallback state.
Most of the time, flushSync can be avoided, so use flushSync as a last resort.
Examples
Using flushSync to force synchronous updates
flushSync forces React to flush pending work synchronously, which can degrade performance and cause Suspense fallbacks to appear unexpectedly.
// Problem: flushSync hurts performance and can trigger unexpected fallback states.
import { flushSync } from "react-dom";
flushSync(() => {
setSomething(123);
});Versions
Resources
Further Reading
See Also
react-dom/no-find-dom-node
DisallowsfindDOMNode.react-dom/no-render
Replaces usage ofReactDOM.render()withcreateRoot(node).render().