mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
Fixed "Controlling an input with a state variable " error
See https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable
This commit is contained in:
@@ -3,7 +3,7 @@ import React, { useState, useRef, useEffect, use } from "react";
|
|||||||
const ShareLink = () => {
|
const ShareLink = () => {
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const [currentUrl, setCurrentUrl] = useState<string>();
|
const [currentUrl, setCurrentUrl] = useState<string>("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentUrl(window.location.href);
|
setCurrentUrl(window.location.href);
|
||||||
@@ -36,6 +36,7 @@ const ShareLink = () => {
|
|||||||
readOnly
|
readOnly
|
||||||
value={currentUrl}
|
value={currentUrl}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
|
onChange={() => {}}
|
||||||
className="border rounded-lg md:rounded-xl p-2 flex-grow mr-2 text-sm bg-slate-100 outline-slate-400"
|
className="border rounded-lg md:rounded-xl p-2 flex-grow mr-2 text-sm bg-slate-100 outline-slate-400"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user