-
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
add solution #1015
base: master
Are you sure you want to change the base?
add solution #1015
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.
GJ 👍
Let's clean up a bit ;)
src/App.tsx
Outdated
export const App = () => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
const dispatch = useDispatch(); | ||
const currentUser = useSelector((state: RootState) => state.currentTodo); |
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.
currentUser !== state.currentTodo
src/App.tsx
Outdated
getTodos() | ||
.then(todos => dispatch(setTodos(todos))) | ||
.finally(() => setIsLoading(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.
React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array
src/App.tsx
Outdated
<TodoModal /> | ||
</> | ||
); | ||
{currentUser && <TodoModal todo={currentUser} />} |
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.
todo != user
getUser(todo.userId) | ||
.then(userByTodo => setUser(userByTodo)) | ||
.finally(() => setIsLoading(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.
React Hook useEffect has a missing dependency: 'todo.userId'. Either include it or remove the dependency array
src/function/filterFunc.ts
Outdated
case 'active': | ||
return filtred.filter(todo => todo.completed === false); | ||
case 'completed': | ||
return filtred.filter(todo => todo.completed === true); | ||
case 'all': |
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.
magic strings
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 👍
But review my comments and fix them 🥹
src/App.tsx
Outdated
{isLoading && <Loader />} | ||
{!isLoading && <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.
Change syntax(In all such cases)
{isLoading && <Loader />} | |
{!isLoading && <TodoList />} | |
{ | |
isLoading | |
? <Loader /> | |
: <TodoList /> | |
} |
return ( | ||
<form | ||
className="field has-addons" | ||
onSubmit={event => event.preventDefault()} | ||
> | ||
<p className="control"> | ||
<span className="select"> | ||
<select data-cy="statusSelect"> | ||
<select data-cy="statusSelect" value={status} onChange={handleChange}> |
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.
if u have 3 or more attributes, move them to separate lines
<select data-cy="statusSelect" value={status} onChange={handleChange}> | |
<select | |
data-cy="statusSelect" | |
value={status} | |
onChange={handleChange} | |
> |
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.
I can't do this because if I display the information in three rows, after saving, it automatically returns to the blackberry row
const handleQuery = (queryPayload: string) => { | ||
dispatch(changeQuary(queryPayload)); | ||
}; |
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.
this function receive event by default, change it
const handleQuery = (queryPayload: string) => { | |
dispatch(changeQuary(queryPayload)); | |
}; | |
const handleQuery = (e: ChangeEvent<HTMLInputElement>) => { | |
dispatch(changeQuary(e.target.value)); | |
}; |
src/components/TodoList/TodoList.tsx
Outdated
</td> | ||
</tr> | ||
))} | ||
{/* | ||
<tr data-cy="todo"> |
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.
remove all comments from project
{isLoading && <Loader />} | ||
|
||
<Loader /> | ||
{!isLoading && ( |
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.
The same problem with syntax
isLoading ? (
<Loader />
) : (
......
)
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