Good day; I m in need of assistance with the following problem:
反应类别组成部分(编号React.Component
)暴露了将其置于指挥状态的方法。 我知道,用推进剂处理这一构成部分可能解决这个问题,但这一公开方法对我的具体设想极为有益,我很不愿意放弃。
The method looks like this:
public setContent = (newDoc: IDocsEntry) => {
console.log( Updating with , newDoc);
this.setState(() => ({doc: newDoc}), () => console.log(this.state.doc));
};
我也进行了审判。
public setContent = (newDoc: IDocsEntry) => {
console.log( Updating with , doc);
this.setState(() => ({newDoc: {id: doc.id, path: doc.path, title: doc.title, content: doc.content}}), () => console.log(this.state.doc));
};
The issue is as following:
- on initially setting this state using this method, everything works as expected
- when I then close this component (it lives in a modal), do something else and then try to update the state using this method, it simply does not update
在我的ole志中,我可以看到,这一方法被称作是新的正确目标,但<条码>的<国家<>/代码>的提示只是从首次援引这一功能时就显示出了老状态。