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

Dynamic list of posts #920

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

Conversation

dimkamg21
Copy link

@dimkamg21 dimkamg21 commented Sep 23, 2023

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide the demo link in the PR description

@dimkamg21 dimkamg21 changed the title commets to be fixed Dynamic list of posts Sep 24, 2023
Copy link

@VitaliyBondarenko1982 VitaliyBondarenko1982 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job.
Please check comments.

src/App.tsx Outdated
handleDropdown={setIsDropdownOpen}
selectedUser={selectedUser}
handleSelectedUser={setSelectedUser}
// setSelectedPost={setPosts}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code. check other places

Comment on lines 17 to 19
const [commentName, setCommentName] = useState('');
const [commentEmail, setCommentEmail] = useState('');
const [commentText, setCommentText] = useState('');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [commentName, setCommentName] = useState('');
const [commentEmail, setCommentEmail] = useState('');
const [commentText, setCommentText] = useState('');
const [newComment, setNewComment] = useState({
name: '',
email: '',
text: '',
});

suggest to make one state for all inputs and change proper field with event.target.name in one change handler instead three (key in state object should be the same as name attribute in input)
somethign like that

    const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    const { value, name } = event.target;
    setNewComment(prevNewComment => ({
        ...prevNewComment,
       [name]: value,
    }) );
  };

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job

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