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

add solution #2121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add solution #2121

wants to merge 1 commit into from

Conversation

A1eeex
Copy link

@A1eeex A1eeex commented Oct 23, 2023

Copy link

@Ayogoharo Ayogoharo left a comment

Choose a reason for hiding this comment

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

Great job!

Comment on lines +7 to +13
export const UserInfo: React.FC<Props> = ({ user }) => {
return (
<a className="UserInfo" href={`mailto:${user?.email}`}>
{user?.name}
</a>
);
};

Choose a reason for hiding this comment

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

[REACT KNOWLEDGE] - Don't render the component if the property that you pass to the component has null or undefined value.
you should check if user is not undefined before render

Copy link

@polosanya polosanya 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! I'm approving it, but please pay attention to the comments)


export const App = () => {
const [currentData, setCurrentData] = useState<TodoWithUser[]>(dataList);
const [title, setTitle] = useState('');
const [currennUserId, setCurrentUserId] = useState(0);

Choose a reason for hiding this comment

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

Suggested change
const [currennUserId, setCurrentUserId] = useState(0);
const [currentUserId, setCurrentUserId] = useState(0);

return usersFromServer.find((user) => user.id === userId) || null;
}

const dataList = todosFromServer.map((todo) => {

Choose a reason for hiding this comment

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

Suggested change
const dataList = todosFromServer.map((todo) => {
const todosWithUsers = todosFromServer.map((todo) => {

Would be great to use descriptive meaningful names

setSelectValid(false);
}

const handlerSubmit = (event: React.ChangeEvent<HTMLFormElement>) => {

Choose a reason for hiding this comment

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

Suggested change
const handlerSubmit = (event: React.ChangeEvent<HTMLFormElement>) => {
const handleSubmit = (event: React.ChangeEvent<HTMLFormElement>) => {

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