I use reaction 16.3.0-alpha.1 and have a problem adding an empty object with key "elements" to the list object.
Addlist.js
createList = event => {
event.preventDefault();
const list = {
items: {},
title: this.titleRef.current.value
};
this.props.addList(list);
event.currentTarget.reset();
};
App.js
state = {
lists: {}
};
addList = list => {
const lists = { ...this.state.lists };
lists[`${list.title}`] = list;
console.log(lists);
this.setState({ lists: lists });
};
When the createList event occurs, it calls the addList method on app.js and passes the list object to the method. When I mount the log lists right before setState, I see that "list3" has been added with "elements" and "heading". But when I used the dev tools to view the state, it only displays the "title" key with its value. I also get an error message indicating that the key "items" in "list3" are null or undefined.


?
setState, - ?
, , , .
list.items = {} list.items = ". . , " list.items ", , . , " list.items" . . setState.
, , .