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 task solution #1135

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

Conversation

roman-logos-frontend
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! 🎉 Your code meets the core functionality and constraints, and you've effectively used React and React Router for managing state and navigation. While there are a few areas for optimization and improvement, such as optimizing data handling and refining error messages, these do not critically impact the functionality of your solution. Keep up the good work and consider these suggestions for future enhancements! 😊

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

{['16', '17', '18', '19', '20'].map(century => (
<SearchLink
key={century}
params={{ centuries: toggleCentury(century) }}

Choose a reason for hiding this comment

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

The toggleCentury function is called directly within the params prop of SearchLink. This means it will be executed on every render, which could lead to unexpected behavior. Consider refactoring this logic to ensure toggleCentury is only called when necessary, such as within an event handler.

setPeople(data);
setLoading(false);
} catch (e) {
setError('Something went wrong');

Choose a reason for hiding this comment

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

Consider providing more detailed error information to the user, if available. This can help users understand what went wrong and potentially how to fix it. You might want to log the actual error message or display it conditionally.

@@ -1,5 +1,65 @@
/* eslint-disable jsx-a11y/control-has-associated-label */
export const PeopleTable = () => {
import React from 'react';
import data from '../../public/api/people.json';

Choose a reason for hiding this comment

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

Importing data directly from a JSON file within the component can lead to performance issues, especially if the data is large. Consider fetching the data asynchronously or passing it as a prop to the component.

import { Person } from '../types/Person';

const getSlugByName = (name: string) => {
const person = data.find(p => p.name === name);

Choose a reason for hiding this comment

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

The getSlugByName function searches through the entire dataset each time it's called. This could be inefficient if the dataset is large. Consider optimizing this by using a more efficient data structure or caching the results.

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