【发布时间】:2020-05-31 14:46:54
【问题描述】:
在加载所有预期的组件后,我将不得不渲染一个新组件。我将需要一个超时,基于该超时必须呈现新组件。所以这个新组件必须在页面加载 5 分钟后出现。 我需要渲染一个名为 new_component 的组件,它扩展了 React.component
public componentDidMount(): void {
if (visited) {
setTimeout(() => {
console.log('Reached the timeout')
//Render the new conponent here. (Not sure how to call the render function of another component here)
}, timeout);
}
谁能帮我在componentDidMount中调用new_component的渲染函数。我试过 new_component.render()。但这似乎不起作用。
【问题讨论】: