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 EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
|
||||||
const [internalStatus, setInternalStatus] = useState<string | undefined>()
|
const [internalStatus, setInternalStatus] = useState<string>('')
|
||||||
const [newName, setNewName] = useState<string | undefined>(undefined)
|
const [newName, setNewName] = useState<string>('')
|
||||||
const dialogRef = useRef<HTMLDialogElement>(null)
|
const dialogRef = useRef<HTMLDialogElement>(null)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -70,8 +70,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dialogRef.current.close()
|
dialogRef.current.close()
|
||||||
setInternalStatus(undefined)
|
setInternalStatus('')
|
||||||
setNewName(undefined)
|
setNewName('')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
@@ -98,8 +98,8 @@ const EditWordList: FC<RenameWordListProps> = ({ currentWordList }) => {
|
|||||||
}
|
}
|
||||||
addWordList(newName, internalStatus.split('\n'))
|
addWordList(newName, internalStatus.split('\n'))
|
||||||
dialogRef.current.close()
|
dialogRef.current.close()
|
||||||
setInternalStatus(undefined)
|
setInternalStatus('')
|
||||||
setNewName(undefined)
|
setNewName('')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
|
|||||||
Reference in New Issue
Block a user