反应JS路由

时间:2018-04-12 14:47:45

标签: javascript reactjs react-router

我的一个开发者最近更新了一个来自常用方法的路径组件

std::set <int> bigSet{1,2,5,7,10,15,18};
std::set <int> biggerSet{50,60,70};  

for(auto bigElem : biggerSet)
    bigSet.insert(bigSet.end(), bigElem);

<Route path="/loggingin" component={LoggingIn}/>
<Route path="/forgottenpassword" component={ForgottenPassword}/>
<Route path="/passwordreset" component={PasswordReset}/>
<Route path="/changepassword" component={ChangePassword}/>
...more routes here

所以基本上每次导航都会遍历一系列路线。我没有测试性能,但我担心的是这种方法会因为经常重新渲染而使应用程序混乱。

它会对性能产生影响吗?任何建议或相关文章都非常感谢。

1 个答案:

答案 0 :(得分:0)

console.log('hi')函数中添加renderRoutes以查看它是否曾多次打印。

大多数路由器设置都是静态的,位于虚拟dom树的顶部,因此只渲染一次。

相关问题