Reactjs 在React中从父管线移动到嵌套管线时,防止父管线重新装载/渲染
我已经为react web应用程序使用了CreateReact应用程序启动工具包Reactjs 在React中从父管线移动到嵌套管线时,防止父管线重新装载/渲染,reactjs,react-router,create-react-app,Reactjs,React Router,Create React App,我已经为react web应用程序使用了CreateReact应用程序启动工具包 //Route.js <Route path='/dashboard' component={Dashboardpage}> <Route path='editprofile' component={Editprofile} /> <Route path='changepassword' component={changepassword} /> </Route&
//Route.js
<Route path='/dashboard' component={Dashboardpage}>
<Route path='editprofile' component={Editprofile} />
<Route path='changepassword' component={changepassword} />
</Route>
//Dashboardpage.js
render()
{
return(
............
............
<div className="center-block">
<h4 className="text-center margin-top-10"><Link to="/dashboard
/editprofile">Edit Profile</Link></h4>
</div>
<div className="center-block">
<h4 className="text-center margin-top-10"><Link to="/dashboard
/changepassword">Change Password</Link></h4>
</div>
{this.props.children}
............
............
)
}
//Route.js
//Dashboardpage.js
render()
{
返回(
............
............
编辑配置文件
修改密码
{this.props.children}
............
............
)
}
加载仪表板时,仪表板页面会呈现一些静态内容,并带有两个链接“编辑配置文件”和“更改密码”。但在单击编辑配置文件时,会调用路径/dashboard/editprofile,但仪表板页面(即父组件)会再次与子组件(即editprofile)一起呈现,因此会出现闪烁
即使父组件(即editprofile)中没有任何更改,也会重新呈现该组件。请帮助我了解如何避免闪烁或避免在未发生更改时重新呈现父组件