Skip to content
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

Add solution of atsk react_pople-table-basics #1797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Voloshynd
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the task requirements! 🎉 The code is mostly well-structured and meets the core functionality needed. There are a few minor adjustments suggested, such as ensuring the HashRouter is used for GitHub Pages compatibility, including slug in the useEffect dependency array, and considering the use of a PersonLink component. These are small tweaks that can enhance your solution. Keep up the good work and happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

@@ -1,167 +1,52 @@
import { Loader } from './components/Loader';

import { NavLink, Routes, Route, Navigate } from 'react-router-dom';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that you are using HashRouter instead of the default router to be compatible with GitHub Pages, as specified in the task requirements.

Comment on lines +43 to +45
<Route path="/people" element={<People />}>
<Route path=":slug" element={<People/>} />
</Route>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nested route for People with :slug might not be necessary unless there's a specific requirement for it. Consider simplifying the routing if this is not needed.

};

fetchPeople();
}, []);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include slug in the dependency array of useEffect to ensure the effect re-runs when the URL parameter changes. This will correctly update the highlighted person when navigating directly to a person's page.

return (
<tr data-cy="person" key={person.name} className={selectedPerson?.name === person.name ? "has-background-warning" : ''}>
<td>
<Link to={`/people/${person.slug}`} onClick={() => selectPerson(person)} className={person.sex === 'f' ? 'has-text-danger' : ''}>{person.name}</Link>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider creating and using a PersonLink component for rendering links to people, as specified in the task requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants