chore(eslint): fix flash message root element query

This commit is contained in:
Paul Chavard 2022-02-22 13:16:01 +01:00 committed by Pierre de La Morinerie
parent 68e89af775
commit 95b9e47993

View file

@ -1,5 +1,6 @@
import React from 'react';
import { createPortal } from 'react-dom';
import invariant from 'tiny-invariant';
export function FlashMessage({
message,
@ -12,11 +13,13 @@ export function FlashMessage({
sticky?: boolean;
fixed?: boolean;
}) {
const element = document.getElementById('flash_messages');
invariant(element, 'Flash messages root element not found');
return createPortal(
<div className="flash_message center">
<div className={flashClassName(level, sticky, fixed)}>{message}</div>
</div>,
document.getElementById('flash_messages')!
element
);
}