Skip to content

Conversation

ratelChief
Copy link
Owner

Так?


render() {
const { todoList, removeTodo } = this.props;
const btnAdd = <button onClick={this.onAddBtn}>+</button>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Такое лучше выносить в методы класса, либо в отдельый компонент

const { todoList, removeTodo } = this.props;
const btnAdd = <button onClick={this.onAddBtn}>+</button>;

const renderItem = todoList.map(item =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

аналогично, лучше вынести в отдельный метод

} from '../utils.js';

const initialState = {
todoList: getFromLocalStorage(TODOLIST)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Если два разных слово, то в коснтантах пишут через _ -> TODO_LIST


return (
<div>
<input onChange={this.onInputChange} type='text' /> {btnAdd}
Copy link
Collaborator

Choose a reason for hiding this comment

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

в инпут надо value записывать из стейта

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