Skip to content

Instantly share code, notes, and snippets.

@vinnymac
Created February 1, 2023 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinnymac/0dc12c4eb29c8f157142521b38426593 to your computer and use it in GitHub Desktop.
Save vinnymac/0dc12c4eb29c8f157142521b38426593 to your computer and use it in GitHub Desktop.
Ignore React 18 DOM render warning
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