【发布时间】:2021-08-16 22:05:15
【问题描述】:
我正在使用 React。我正在使用类组件。 我也在使用 React Router。
这是我的代码:
constructor(props){
super(props);
}
handleCreateComponent = () =>{
return this.props.history.push('/app/pages/pageA/new');
}
render = () =>{
return(
<div>
<div>
<Button id="addComponent" onClick={this.handleCreateComponent}>ButtonA</Button>
</div>
</div>
);
}
我的问题:
当我单击“ButtonA”时,它会导航到链接:/app/pages/pageA/new 但是,该页面是空的,即使它应该呈现,也没有显示任何内容。
可能是什么问题?
【问题讨论】:
-
你能贴出那个页面的代码吗?
-
请提供您遇到问题的相关代码的Minimal, Complete, and Reproducible Code Example。换句话说,您希望看到的页面呈现的是什么?
标签: javascript reactjs react-redux react-router react-hooks