Skip to content

HM4#51

Open
WejusT1k wants to merge 1 commit intoromabelka:masterfrom
WejusT1k:jusHM4
Open

HM4#51
WejusT1k wants to merge 1 commit intoromabelka:masterfrom
WejusT1k:jusHM4

Conversation

@WejusT1k
Copy link

No description provided.

return this.props.articles.map((article) => ({
label: article.title,
value: article.id
const articles = Object.keys(this.props.articles)
Copy link
Owner

Choose a reason for hiding this comment

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

Лучше селектор, который достанет из в виде массива

super(props)

this.state = {
isValid: true
Copy link
Owner

Choose a reason for hiding this comment

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

Валидацию лучше проводить при рендере, всегда старайся хранить минимальное состояние

this.props.addComment(comment)

this.name.current.value = ''
this.comment.current.value = ''
Copy link
Owner

Choose a reason for hiding this comment

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

Не трогай ref без крайней необходимости. Храни значения в state

export default (store) => (next) => (action) => {
const { type } = action
switch (type) {
case ADD_COMMENT: {
Copy link
Owner

Choose a reason for hiding this comment

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

через мидлвары будет проходить каждый экшин, они должны быть максимально общими, завязывать на конкретные экшины - не лучшее решение

return articlesState.map((el, index) => {
if (index === parseInt(payload.articleId)) {
let newArr = Array.prototype.concat(el.comments, payload.id)
el.comments = Array.prototype.concat(newArr)
Copy link
Owner

Choose a reason for hiding this comment

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

Не понял, что ты тут делаешь

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.

2 participants