-
Notifications
You must be signed in to change notification settings - Fork 4
Detail Page Navigation #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| <Route path="/explore" element={<ExplorePage />} /> | ||
| <Route path="/card/:id" element={<CardDetailPage />} /> | ||
| <Route path="/detail" element={<ImageDetailPage />} /> | ||
| <Route path="/detail/:id" element={<ImageDetailPage />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ImageDetailPage doesn't seem to handle the id parameter, as in the CardDetailPage component that uses useParams hook to extract the id parameter from the route. My understanding is that if the id is required for rendering the content it might lead to unexpected behavior when the id might be needed for fetching the data or rendering specific details.
My suggestion would be to use the same hook as in the CardDetailsPage to extract the id. If the ImageDetailPage was not intended, might need adjustment.
|
|
||
| function ImageDetailPage() { | ||
| const location = useLocation(); | ||
| const { image } = location.state || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can happen that the location is undefined or the image is missing so we need to check for it.
e.g.
if (!image){ return <div>No image available</div> }
| {galleryImages.map((image, index) => ( | ||
| <div key={index} className={styles.imageContainer}> | ||
| <div className={styles.imageWrapper}> | ||
| <Link to={`/detail/${index}`} key={index} state={{ image: image }} > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key prop isn't needed here as you specified it already in line 74.
No description provided.