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

solution #7

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

solution #7

wants to merge 9 commits into from

Conversation

8hokage
Copy link

@8hokage 8hokage commented Jul 11, 2019

src/App/App.js Outdated
this.setState({ ...state });
}

componentWillUpdate(nextProps, nextState, nextContext) {
Copy link
Contributor

Choose a reason for hiding this comment

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

у этого метода нет никаких парметров!!!

src/App/App.js Outdated
}

changeFilter = async(e) => {
console.log(e.target);
Copy link
Contributor

Choose a reason for hiding this comment

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

поубирай пожалуйста лишний код

src/App/App.js Outdated
filterValue = filterValue[1];
} else {
filterValue = '';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

если ты уже начал парсить href то пора использовать React Router

src/App/App.js Outdated
status = true;
break;
case 'active':
status = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

чем создавать переменную проще тут сделать return того что нужно
Может добавится больше фильтров или логика изменится
Да и нагляднее будет - что именно возвращаем в каждом случае когда

src/App/App.js Outdated
const index = todosList.findIndex(todo => todo.id === id);
const togle = !todosList[index].completed;

todosList[index].completed = togle;
Copy link
Contributor

@mgrinko mgrinko Jul 12, 2019

Choose a reason for hiding this comment

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

const todos = prevState.todos.map(todo => {
  if (todo.id !== id) {
    return todo;
  }

  return {
    ...todo,
    completed: !todo.completed,
  };
});

const completedTodos = todos.filter(todo => todo.completed)

return { todos, completedLength: completedTodos.length };

Copy link
Contributor

Choose a reason for hiding this comment

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

src/App/App.js Outdated
};
});

completedLength = togle ? prevState.todosList.length : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

простота поддержки иногда важнее производительности
https://zoom.us/recording/share/0toADjnabJSYr5BrwhxuYQ8YXxuXzjke_u7ga_mD7cawIumekTziMw

src/App/App.js Outdated
const list = [...prevState.todosList];
list.push(todoItem);
return { todosList: list, inputValue: '' };
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@mgrinko mgrinko left a comment

Choose a reason for hiding this comment

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

Всё досмотреть не успеваю
Внеси пожалуйста правки (и по другим моим видеоразборам изhttps://www.youtube.com/watch?v=EwHQ8MrrANE&list=PL7FuXFaDeEX3AbsSUG1LvTr8UF5UvKatw)

Copy link
Contributor

@vpolets vpolets left a comment

Choose a reason for hiding this comment

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

Прийняв, там один баг є, якщо в інпуті стерти повністю todo то він має пропадати, а він не прорадає.
А так дуже крута робота:)

{
todosLength > 0 && (
<>
<TodoList filter={params.filter} />
Copy link
Contributor

Choose a reason for hiding this comment

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

ToDoList in heder? footer in heder???

Copy link
Author

Choose a reason for hiding this comment

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

Heder их не оборачивает

Copy link
Author

Choose a reason for hiding this comment

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

Пофиксил баг в инпуте

AntonSkliarov added a commit to AntonSkliarov/react_todo-app that referenced this pull request Nov 16, 2020
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