Created
February 1, 2023 03:24
-
-
Save vinnymac/0dc12c4eb29c8f157142521b38426593 to your computer and use it in GitHub Desktop.
Ignore React 18 DOM render warning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function ignoreReact18DOMrenderWarning() { | |
const originalError = console.error; | |
beforeAll(() => { | |
console.error = (...args) => { | |
if (/Warning: ReactDOM.render is no longer supported in React 18./.test(args[0])) { | |
return; | |
} | |
originalError.call(console, ...args); | |
}; | |
}); | |
afterAll(() => { | |
console.error = originalError; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment