-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13 hotfix : eventId 입력 기능 임시 추가 및 MainEventList.tsx 페이지 생성
- Loading branch information
1 parent
12324d3
commit ba22383
Showing
4 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import {useNavigate} from 'react-router-dom'; | ||
|
||
const MainEventList = () => { | ||
const [eventId, setEventId] = React.useState<string | null>(null); | ||
const navigate = useNavigate(); | ||
|
||
// Handle changes in the input field and update the state | ||
const handleEventIdChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setEventId(event.target.value); | ||
}; | ||
|
||
// Navigate to event detail with eventId | ||
const navigateToEventDetail = () => { | ||
if (eventId) { | ||
navigate('/eventDetail', {state: {eventId}}); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<input | ||
type="text" | ||
value={eventId || ''} | ||
onChange={handleEventIdChange} | ||
placeholder="Enter Event ID" | ||
/> | ||
<button onClick={navigateToEventDetail}>Go to Event</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MainEventList; |