Skip to content

Hw 5#73

Open
ls16 wants to merge 5 commits intoromabelka:masterfrom
ls16:hw-5
Open

Hw 5#73
ls16 wants to merge 5 commits intoromabelka:masterfrom
ls16:hw-5

Conversation

@ls16
Copy link

@ls16 ls16 commented Feb 4, 2018

No description provided.

const {articles} = this.props
if (!articles.length) return <h3>No Articles</h3>
const articleElements = articles.map((article) => <li key={article.id}>
const articleElements = Object.values(articles).map((article) => <li key={article.id}>
Copy link
Owner

Choose a reason for hiding this comment

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

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

}

switch (action.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.

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


switch (action.type) {
case ADD_COMMENT:
action.payload.id = genId(10)
Copy link
Owner

Choose a reason for hiding this comment

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

лучше не мутировать payload, мало-ли что там станут передавать

return articlesState
case ADD_COMMENT:
let article = {...articlesState[payload.articleId]}
article.comments = [...article.comments]
Copy link
Owner

Choose a reason for hiding this comment

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

comments может быть undefined


const enhancer = composeEnhancers(
applyMiddleware(logger)
applyMiddleware(logger, idGenerator)
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.

3 participants