Course lesson

Handle Class Component setState edge-case with ReactDOM.flushSync

React 17 had an edge-case that meant that this.state could show partial state changes. This was never intended and has been patched in React 18. In cases where you need that same behavior, ReactDOM.flushSync to achieve the same result. While it's an available...

Duration
2 min
Access
Included
Transcript
Retained from source evidence

React 17 had an edge-case that meant that this.state could show partial state changes. This was never intended and has been patched in React 18. In cases where you need that same behavior, ReactDOM.flushSync to achieve the same result. While it's an available option, it is not recommended.