You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
neither/bug
What is the current behavior?
While migrating class components to function components (with hooks), I noticed a significant performance drop. I have a component (called TreeNodeComponent) which is part of a tree-structure. Depending on the tree size, hundreds of instance could be visible.
The App renders hundreds of these TreeNodeComponent in a tree-structure. When a parent is updated, all direct children need to be reconciled.
Project: https://github.com/thomasnordquist/MQTT-Explorer
What is the expected behavior?
Comparable performance between functional and class components.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Wrapping the function component in a PureComponent significantly reduced the observed "render time". (From ~160ms to ~60ms)
Thats expected if rendering TreeNodeComponent is expensive. React.PureComponent bails out early if props haven't changed.
While migrating class components to function components (with hooks), I noticed a significant performance drop.
Are you saying that going from a class extending React.Component to a function component caused a performance regression? Or were you already using React.PureComponent (or shouldComponentUpdate)
You can use React.memo to get the same bailout semantics with function components.
Do you want to request a feature or report a bug?
neither/bug
What is the current behavior?
While migrating class components to function components (with hooks), I noticed a significant performance drop. I have a component (called
TreeNodeComponent
) which is part of a tree-structure. Depending on the tree size, hundreds of instance could be visible.Wrapping the function component in a PureComponent significantly reduced the observed "render time". (From ~160ms to ~60ms)
"Render time", observed in Chrome Dev Tools
Context:
The App renders hundreds of these
TreeNodeComponent
in atree-structure
. When a parent is updated, all direct children need to be reconciled.Project: https://github.com/thomasnordquist/MQTT-Explorer
What is the expected behavior?
Comparable performance between functional and class components.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
OSX
Chromium 73 / Electron 5.0.5
React 16.8
Typescript & Webpack
The text was updated successfully, but these errors were encountered: