fixes the portal that I "fixed" before
This commit is contained in:
parent
3c8f5bb8ba
commit
3ae4dfcc82
@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { FC, PropsWithChildren, useEffect, useState } from "react";
|
import { FC, PropsWithChildren, useEffect, useState } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
@ -14,7 +12,7 @@ export const Portal: FC<PropsWithChildren<IProps>> = (
|
|||||||
const [container] = useState(() => {
|
const [container] = useState(() => {
|
||||||
// This will be executed only on the initial render
|
// This will be executed only on the initial render
|
||||||
// https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
|
// https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
|
||||||
return document.getElementById("root-portal") || document.createElement(el);
|
return document.createElement(el);
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: this smells. appending the same element?
|
// todo: this smells. appending the same element?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user