fix: uncontrolled component

This commit is contained in:
2025-08-14 15:05:39 -06:00
parent b4e802fdec
commit 25cf8ab255
2 changed files with 9 additions and 9 deletions

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -11,8 +11,8 @@ export interface RenameWordListProps {
}
const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
const [internalStatus, setInternalStatus] = useState<string | undefined>()
const [newName, setNewName] = useState<string | undefined>(undefined)
const [internalStatus, setInternalStatus] = useState<string>('')
const [newName, setNewName] = useState<string>('')
const dialogRef = useRef<HTMLDialogElement>(null)
return (
@@ -70,8 +70,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
return
}
dialogRef.current.close()
setInternalStatus(undefined)
setNewName(undefined)
setInternalStatus('')
setNewName('')
}}
>
Close
@@ -98,8 +98,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
}
addWordList(newName, internalStatus.split('\n'))
dialogRef.current.close()
setInternalStatus(undefined)
setNewName(undefined)
setInternalStatus('')
setNewName('')
}}
>
Save