我在反应新的,可能做错了什么。反应变化道具海量错误
我有一个主父组件和他的孩子和孩子主要的儿童(儿童2)的。
main-> child1->子2
我发送数据通过props.items到child1:
main.js
<child1 items={this.state.lst}>
然后我重新发送到CHILD2:
child1.js
search(res){
this.props.items=res;
}
<Find dataChild2={this.props.items} findData={this.search.bind(this)}/>
在孩子2我改变了这个数据,并调用child1功能搜索:
child2.js
someFunc(){
//manipulate with this.props.dataChild2 and write it in result;
this.props.findData(result);
}
我只是想重写的搜索功能this.props.items但有一个错误:
×
TypeError: Cannot assign to read only property 'items' of object '#<Object>'
我该如何正确更改它?由于
谢谢,这对我的作品。 – Redair