-
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
Done!(try1) #2112
base: master
Are you sure you want to change the base?
Done!(try1) #2112
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.
Demo link not working (
NewMovie.scss - empty.
Try to redeploy application.
Check comments for improvements.
Many thanks!
src/components/NewMovie/NewMovie.tsx
Outdated
const isDisabled = !( | ||
fieldsOfMovie.title | ||
&& fieldsOfMovie.imgUrl | ||
&& fieldsOfMovie.imdbUrl | ||
&& fieldsOfMovie.imdbId); |
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.
Try rewrite for more readability
src/components/NewMovie/NewMovie.tsx
Outdated
imdbId: '', | ||
}; | ||
|
||
type Props = { |
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.
type Props = { | |
interface Props = { |
src/components/NewMovie/NewMovie.tsx
Outdated
title: fieldsOfMovie.title, | ||
description: fieldsOfMovie.description, | ||
imgUrl: fieldsOfMovie.imgUrl, | ||
imdbUrl: fieldsOfMovie.imdbUrl, | ||
imdbId: fieldsOfMovie.imdbId, |
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.
title: fieldsOfMovie.title, | |
description: fieldsOfMovie.description, | |
imgUrl: fieldsOfMovie.imgUrl, | |
imdbUrl: fieldsOfMovie.imdbUrl, | |
imdbId: fieldsOfMovie.imdbId, | |
...fieldsOfMovie, |
src/components/NewMovie/NewMovie.tsx
Outdated
const changeFieldHandler = (name: Field, value: string) => { | ||
setFieldsOfMovie(prevFields => ({ ...prevFields, [name]: value })); | ||
}; |
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.
const changeFieldHandler = (name: Field, value: string) => { | |
setFieldsOfMovie(prevFields => ({ ...prevFields, [name]: value })); | |
}; | |
const changeFieldHandler = (key: Field) => ( value: string) => { | |
setFieldsOfMovie(prevFields => ({ ...prevFields, [key]: value })); | |
}; |
You can make it closure for best view )
src/components/NewMovie/NewMovie.tsx
Outdated
value="" | ||
onChange={() => {}} | ||
value={fieldsOfMovie.title} | ||
onChange={(value) => changeFieldHandler('title', value)} |
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.
onChange={(value) => changeFieldHandler('title', value)} | |
onChange={changeFieldHandler('title')} |
And use it so
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.
Good job!
Approved.
Thanks!
DEMO LINK