1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-12-15 04:13:36 +01:00

Move alert to portal

This commit is contained in:
Maciej Lenartowicz
2019-11-12 12:50:29 +00:00
parent ee5cf07614
commit a51ba0630d
5 changed files with 24 additions and 34 deletions

View File

@@ -12,8 +12,10 @@ import { useAlert, AlertContextProvider } from "../AlertContext";
function AlertTest() {
const [setAlert, dismissAlert] = useAlert();
// alert-container serves as an output for Portal which renders Alert
return (
<>
<div id="alert-container" />
<button onClick={() => setAlert("Alert content")}>Set alert</button>
<button onClick={dismissAlert}>Dismiss alert</button>
</>