Skip to content

Commit 5416dcc

Browse files
committed
fix: ts18047 build error
1 parent 6d3c84e commit 5416dcc

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

โ€Žsrc/components/MyCalendar/CreateEventButton.tsxโ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const CreateEventButton = () => {
88
const [eventTitle, setTitle] = useState('');
99
const [startDate, setStartDate] = useState('');
1010
const [endDate, setEndDate] = useState('');
11-
const titleRef = useRef(null);
12-
const startRef = useRef(null);
13-
const endRef = useRef(null);
11+
const titleRef = useRef<HTMLInputElement>(null);
12+
const startRef = useRef<HTMLInputElement>(null);
13+
const endRef = useRef<HTMLInputElement>(null);
1414

1515
const onTitleChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
1616
setTitle(event.target.value);
@@ -31,9 +31,15 @@ const CreateEventButton = () => {
3131
setTitle('');
3232
setStartDate('');
3333
setEndDate('');
34-
titleRef.current.value = null;
35-
startRef.current.value = null;
36-
endRef.current.value = null;
34+
if (titleRef.current) {
35+
titleRef.current.value = '';
36+
}
37+
if (startRef.current) {
38+
startRef.current.value = '';
39+
}
40+
if (endRef.current) {
41+
endRef.current.value = '';
42+
}
3743
};
3844

3945
const eventForm = (

0 commit comments

Comments
ย (0)