fix: uncontrolled component
This commit is contained in:
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user