-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 #2723
base: master
Are you sure you want to change the base?
add task solution #2723
Conversation
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.
Thank you for your hard work on the NewMovie
component! 🎬 While your implementation meets many of the task requirements, there are some critical issues with the onChange
handlers that need to be addressed. Each set
function (like setImdbId
, setImdbUrl
, setImgUrl
, setDescription
, and setTitle
) should be used as an onChange
handler that takes an event and updates the state accordingly. This is crucial for the form to function correctly. Once these issues are resolved, your component will be in great shape! Keep up the great work and don't hesitate to reach out if you need any help. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
src/components/NewMovie/NewMovie.tsx
Outdated
value="" | ||
onChange={() => {}} | ||
value={title} | ||
onChange={setTitle} |
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 onChange
prop for the TextField
component should be a function that takes an event and updates the state. Currently, setTitle
is being passed directly, which is not correct unless TextField
is designed to handle it. Ensure TextField
calls the onChange
function with the new value or event.
src/components/NewMovie/NewMovie.tsx
Outdated
<TextField | ||
name="description" | ||
label="Description" | ||
onChange={setDescription} |
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.
Similar to the previous comment, ensure that setDescription
is correctly used as the onChange
handler. It should be a function that takes an event and updates the state.
src/components/NewMovie/NewMovie.tsx
Outdated
name="imgUrl" | ||
label="Image URL" | ||
value={imgUrl} | ||
onChange={setImgUrl} |
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.
Ensure that setImgUrl
is correctly used as the onChange
handler. It should be a function that takes an event and updates the state.
src/components/NewMovie/NewMovie.tsx
Outdated
name="imdbUrl" | ||
label="Imdb URL" | ||
value={imdbUrl} | ||
onChange={setImdbUrl} |
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.
Ensure that setImdbUrl
is correctly used as the onChange
handler. It should be a function that takes an event and updates the state.
src/components/NewMovie/NewMovie.tsx
Outdated
name="imdbId" | ||
label="Imdb ID" | ||
value={imdbId} | ||
onChange={setImdbId} |
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.
Ensure that setImdbId
is correctly used as the onChange
handler. It should be a function that takes an event and updates the 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.
Great job on implementing the NewMovie
component! 🎉 While your solution meets most of the task requirements, there are a few areas for improvement:
-
onChange Handlers: Ensure that the
onChange
handlers for theTextField
components are correctly implemented to handle events, not just string values. This is crucial for maintaining React's standard practices. -
Form Validation: Make sure the form validation logic is robust. The
isFormValid
variable should accurately reflect whether all required fields (title
,imgUrl
,imdbUrl
, andimdbId
) are filled out. Additionally, ensure that theonBlur
functionality for validation is properly integrated. -
Code Style: Avoid using one-letter variable names for event handlers. Descriptive names improve code readability and maintainability.
-
MoviesList Component: Verify that the
MoviesList
component is correctly handling themovies
prop and is capable of rendering the list of movies.
These adjustments will enhance the functionality and readability of your code. Keep up the good work, and use this feedback to refine your skills! Remember, addressing these issues will help you avoid similar problems in the future. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
const isFormValid = | ||
title.trim() && imgUrl.trim() && imdbUrl.trim() && imdbId.trim(); |
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 isFormValid
variable is used to determine if the form can be submitted. Ensure that all required fields are correctly validated. Currently, it checks if title
, imgUrl
, imdbUrl
, and imdbId
are non-empty, which seems correct given the required fields. However, ensure this logic aligns with your form validation requirements.
</div> | ||
</form> | ||
</form> | ||
<MoviesList movies={movies} /> |
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.
Ensure that the MoviesList
component is correctly implemented to handle the movies
prop. Verify that it exists and is capable of rendering the list of movies passed to it.
DEMO LINK