CopyButton : type du ref compatible React 19 (RefObject<HTMLElement | null>)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LNfwm4yWr3pL8mEeo8475a
This commit is contained in:
1 parent
99e5a7af80
commit
dfe110fdee
1 file changed
+1
-1
@@ -57,7 +57,7 @@ function selectContents(el: HTMLElement | null) {
|
|||||||
type CopyState = "idle" | "ok" | "ko";
|
type CopyState = "idle" | "ok" | "ko";
|
||||||
|
|
||||||
/** Bouton "copier" avec retour visuel : succes (vert) ou echec (rouge), puis retour a l'etat initial. */
|
/** Bouton "copier" avec retour visuel : succes (vert) ou echec (rouge), puis retour a l'etat initial. */
|
||||||
function CopyButton({ text, label, source }: { text: string; label: string; source?: RefObject<HTMLElement> }) {
|
function CopyButton({ text, label, source }: { text: string; label: string; source?: RefObject<HTMLElement | null> }) {
|
||||||
const [state, setState] = useState<CopyState>("idle");
|
const [state, setState] = useState<CopyState>("idle");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (state === "idle") return;
|
if (state === "idle") return;
|
||||||
|
|||||||
Reference in new issue
Block a user