我收到此错误“未能在‘节点’上执行'removeChild‘:要删除的节点不是该节点的子节点。”这是发生在我的第三-第四次下降的选择。
前几次我选择一个下降,表被渲染的很好,不知道为什么在第3-第4次间歇发生这种情况?!
下拉选择函数:
public handleDropdownChange(e) {
this.setState({ selectedOption: e.target.value });
{ setTimeout(() => {
this.getDocuments();
}, 1000); }
{ setTimeout(() => {
this.renderDocuments();
}, 2000); }
}
提供文件功能:
public renderDocuments() {
const docs = this.state.documents.map(document => {
return (
<tr>
<td className="title">{document.Cells.results[3].Value }</td>
<td className="site">{siteName}</td>
<td className="path">{sitePath}</td>
<td><a href={document.Cells.results[6].Value + '?web=1&action=edit'}>View File</a></td>
</tr>
);
});
return (
<div id="tableID" className="table-list-container">
<table className="table-list">
<thead>
<th><button type="button" className="sort" data-sort="title">Title</button></th>
<th><button type="button" className="sort" data-sort="site">Site</button></th>
<th><button type="button" className="sort" data-sort="path">Path</button></th>
<th><button type="button">View File</button></th>
</thead>
<tbody className="list">
{docs}
</tbody>
</table>
<table className="table-footer">
<tr>
<td className="table-pagination">
<ul className="pagination"></ul>
</td>
</tr>
</table>
</div>
);
}
呈现:
public render(): React.ReactElement<IKimProps> {
let { documents } = this.state;
return (
<div className={ styles.kim }>
{"Display Items that are pending review by Favourite Colour:"}
{documents.length === 0 && <p>Loading...</p>}
<select id="dropdown" onChange={this.handleDropdownChange}>
<option value="N/A">N/A</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
<br/><br/>
{this.renderDocuments()}
</div>
);
}
}
发布于 2019-12-05 15:20:42
你说得对,JQuery和React一起使用可能会产生这些结果。有足够的软件包进行反应,我建议使用其中之一。
https://stackoverflow.com/questions/59196061
复制相似问题