-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 solution #2124
base: master
Are you sure you want to change the base?
task solution #2124
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.
Great job. You only need to add labels)
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! I'm approving it, but please pay attention to the comments)
const [titleError, setTitleError] = useState(false); | ||
const [titlePatternError, setTitlePatternError] = useState(false); |
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 newPost = { | ||
id: (Math.max(...posts.map(todo => todo.id)) + 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.
Would be great to create a variable\function for that value
title, | ||
completed: false, | ||
userId: selectedUserId, | ||
user: usersFromServer.find(user => user.id === selectedUserId) || null, |
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.
Same here
{titlePatternError && ( | ||
<span className="error"> | ||
Only ua and en letters, digits, and spaces are allowed |
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.
You could save the error text in the state and use here instead of the boolean value
DEMO LINK