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
Давай посмотрим качество кода #3
Conversation
@@ -0,0 +1,24 @@ | |||
let nextListId = 3 |
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.
Давай-ка этот инкремент выпилим, и лучше добавим функцию генерации уникального id
, вроде такого https://www.npmjs.com/package/uniqid
let nextListId = 3 | ||
|
||
export const addList = text => ({ | ||
type: 'ADD_LIST', |
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.
Текстовые литералы определяющие тип экшена вроде 'ADD_LIST'
лучше вынеси в отдельные константы экспортируемые, ведь ты их используешь больше чем в одном месте
@@ -0,0 +1,58 @@ | |||
import React, { Component } from 'react'; | |||
import BoardsListContainer from '../../containers/BoardsListContainer' |
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.
Не сейчас может быть, но почитай про алиасы вебпака, которые позволяют определить корневой путь у проекта для импортов, чтобы вместо '../../containers /
писать Сontainers/
, например
{ !addListForm && (<button className="board-adding__btn" onClick={this.openFormAddList}>+ Добавьте ещё одну колонку</button>)} | ||
{ addListForm && (<form className="board-adding-form"> | ||
<input ref={el => this.inputTitle = el} className="board-adding-form__input" placeholder="Ввести заголовок списка" /> | ||
<button className="board-adding-form__btn_add" onClick={(e) => { |
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.
Никаких лямбд
<div className="board-adding"> | ||
{ !addListForm && (<button className="board-adding__btn" onClick={this.openFormAddList}>+ Добавьте ещё одну колонку</button>)} | ||
{ addListForm && (<form className="board-adding-form"> | ||
<input ref={el => this.inputTitle = el} className="board-adding-form__input" placeholder="Ввести заголовок списка" /> |
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.
Ref не поправил
No description provided.