-
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
react_add-todo-form solution #2161
base: master
Are you sure you want to change the base?
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.
src/App.tsx
Outdated
</option> | ||
{usersFromServer.map(user => ( | ||
<option | ||
value={user.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.
Destructure user
src/components/TodoInfo/TodoInfo.tsx
Outdated
{user && ( | ||
|
||
<UserInfo user={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.
{user && ( | |
<UserInfo user={user} /> | |
{user && ( | |
<UserInfo user={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.
|
||
export const TodoList: React.FC<Props> = ({ todos }) => { | ||
return ( | ||
<section className="TodoList"> |
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.
Use semantic tags for list ul
li
. Don't forget to remove default li
dots and ul
paddings
src/App.tsx
Outdated
title, | ||
completed: false, | ||
userId, | ||
user: usersFromServer.find(user => user.id === userId), |
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.
looks like you can use here getUserById function
src/App.tsx
Outdated
{usersFromServer.map(({ id, name }) => ( | ||
<option | ||
value={id} | ||
key={name} | ||
> |
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.
do not forget about key prop
src/components/TodoInfo/TodoInfo.tsx
Outdated
{user && ( | ||
|
||
<UserInfo user={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.
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.
Well done
DEMO LINK