反应:在功能组件中使用箭头功能是否会导致更多的重新渲染?

问题描述 投票:0回答:1

使用Class-based Components,我们可以在此状态下使用bind,因为好了state,因此减少了重新渲染。

Functional Components不提供此功能,因为要使用state,我们需要Hooks,并且对于Hooks,该组件获得state的幂而没有一个。

我的问题是:对于整个应用程序,在arrow functions中使用=>Functional Components)是否会导致重新渲染增加?

reactjs components arrow-functions
1个回答
0
投票

好的,arrow function is a short syntax alternative to a regular function expression。它们没有对thisargumentssupernew.target关键字的绑定。

箭头功能很简单ES6,与react功能无关。

实际上,Component lifecycle中的reactstateprops的影响。

因此,除了在setState中调用() => ()的部分之外,箭头功能不会直接或间接影响您的组件渲染/更新。

© www.soinside.com 2019 - 2024. All rights reserved.