-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
solution #858
solution #858
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 job.
Check improvements and test suits!
export interface ProvidedValue { | ||
posts: Post[], | ||
selectedPost: Post | null, | ||
isPostsPending: boolean, | ||
isPostsError: boolean, | ||
handleSelectPost: (post: Post) => void | ||
} |
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 can move it to a separate file.
export interface ProvidedValue { | ||
comments: Comment[], | ||
isCommentsPending: boolean, | ||
isCommentsError: boolean, | ||
addingComment: boolean, | ||
handleDeleteComment: (commentId: number) => Promise<void>, | ||
handleAddComment: (data: CommentData) => Promise<void>, | ||
} |
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 can move it into a separate file.
> | ||
<div className="dropdown-trigger"> | ||
<button | ||
type="button" | ||
className="button" | ||
aria-haspopup="true" | ||
aria-controls="dropdown-menu" | ||
onClick={() => setShowDropdown(prev => !prev)} |
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 a handler.
className={classNames('dropdown-item', { | ||
'is-active': selectedUser?.id === user.id, | ||
})} | ||
onClick={() => handleSelectUser(user)} |
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 a handler.
className={classNames('button is-link', { | ||
'is-light': selectedPost?.id !== post.id, | ||
})} | ||
onClick={() => handleSelectPost(post)} |
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 a handler.
type="button" | ||
className="delete is-small" | ||
aria-label="delete" | ||
onClick={() => handleDeleteComment(comment.id)} |
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 a handler.
const [nameError, setNameError] = useState(false); | ||
const [emailError, setEmailError] = useState(false); | ||
const [bodyError, setBodyError] = 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.
Many states. Try to unite them.
DEMO
TESTS