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

task sol #2103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

task sol #2103

wants to merge 2 commits into from

Conversation

HeySleare
Copy link

Instructions

Copy link

@yaneznayou yaneznayou left a 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 = () =>

Copy link

@SerhiiKirik SerhiiKirik left a 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 = () => {

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)

Suggested change
const reset = () => {
const handleReset = () => {

const handleSubmit = (event: React.FormEvent) => {
event.preventDefault();

setCount(count + 1);

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

Suggested change
setCount(count + 1);
setCount(() => ...);

Comment on lines +34 to +40
onAdd({
title,
description,
imgUrl,
imdbUrl,
imdbId,
});

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

Suggested change
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('');

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({ ... })

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.

3 participants