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 #2743

Closed
wants to merge 1 commit into from

Conversation

amir-al-mohamad
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! 🎉 Your code meets the core requirements, and the functionality is working as expected. There are just a couple of minor improvements you can make: removing the redundant onClick handler on the submit button and ensuring efficient use of the setMovies function. Keep up the good work and continue refining your skills! 😊

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

<NewMovie /* onAdd={(movie) => {}} */ />
<NewMovie
onAdd={(movie: Movie) => {
setMovies([...movies, movie]);

Choose a reason for hiding this comment

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

You are using the spread operator to create a new array when updating the state with setMovies. According to the checklist, if you are using a non-mutating array method, you don't need to create a copy of the array. However, in this case, using the spread operator is necessary to add a new movie to the existing list, so this is acceptable.


<div className="field is-grouped">
<div className="control">
<button
type="submit"
data-cy="submit-button"
className="button is-link"
disabled={!isValid()}
onClick={handleSubmit}

Choose a reason for hiding this comment

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

The onClick handler for the submit button is redundant because the form's onSubmit event already handles the submission. You can safely remove onClick={handleSubmit} to avoid unnecessary duplication.

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