Skip to content

Commit 9050f8a

Browse files
josh-ramos-22Josh Ramos
and
Josh Ramos
authored
added useEffect hook to reset input value when modal is opened/closed (#354)
Co-authored-by: Josh Ramos <[email protected]>
1 parent dda69a8 commit 9050f8a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/src/packages/dashboard/components/ConfirmationModal/ConfirmationWindow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useEffect, useState } from "react";
22
import styled from "styled-components";
33
import { Modal, Typography, TextField, Box } from "@mui/material";
44
import { useDispatch } from "react-redux";
@@ -44,6 +44,10 @@ export default function ConfirmationWindow({
4444
const [inputValue, setInputValue] = useState<string>("");
4545
const folderState = getFolderState();
4646

47+
useEffect(() => {
48+
setInputValue("");
49+
}, [modalState]);
50+
4751
const handleSubmit = () => {
4852
switch (modalState.type) {
4953
case "folder": {

0 commit comments

Comments
 (0)