-
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
task sol #2103
base: master
Are you sure you want to change the base?
task sol #2103
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.
Good solution
I can suggest to add
export const App: React.FC = () =>
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.
Well done 🔥
Check comments 🧑💻
const isDisabled = !title.trim() || !imgUrl.trim() | ||
|| !imdbUrl.trim() || !imdbId.trim(); | ||
|
||
const reset = () => { |
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.
Make all code in 1 style)
const reset = () => { | |
const handleReset = () => { |
const handleSubmit = (event: React.FormEvent) => { | ||
event.preventDefault(); | ||
|
||
setCount(count + 1); |
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.
do it with functional setState
setCount(count + 1); | |
setCount(() => ...); |
onAdd({ | ||
title, | ||
description, | ||
imgUrl, | ||
imdbUrl, | ||
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.
Would be better if you first create some variable and put this variable to function
onAdd({ | |
title, | |
description, | |
imgUrl, | |
imdbUrl, | |
imdbId, | |
}); | |
onAdd(newMovie); |
// Increase the count after successful form submission | ||
// to reset touched status of all the `Field`s | ||
const [count] = useState(0); | ||
const [count, setCount] = useState(0); | ||
const [title, setTitle] = useState(''); |
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.
also, you can combine all these states to 1, form
like
const [form, setForm] = useState({ ... })
Instructions
npm test
to ensure your solution is correct.<your_account>
with your Github username in the DEMO LINK and add it to the PR description.