Handle Class Component setState edge-case with ReactDOM.flushSync

InstructorMichael Chan

Share this video with your friends

Send Tweet

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.