ReactDOMServer has been used to compare React components. Such comparison is not necessary and therefore, the dependency can be removed.
When placing the updateResourceUtilizationView()-call right in the component, it might be called several times due to re-rendering. In order to mitigate re-setting issues, it was important that the updateResourceUtilizationView function sets the corresponding values (setResourceUtilizationPercent and setResourceUtilizationTooltipText) only once/when they actually change.
To recognize such change, the helper-function areReactElementsEqual was implemented which compares React components. This adds a dependency to react-dom/server.
The comparison helper-function, and therefore the dependency, can be removed by moving updateResourceUtilizationView() in a useEffect() that is called only once (see here).
ReactDOMServer has been used to compare React components. Such comparison is not necessary and therefore, the dependency can be removed.
When placing the
updateResourceUtilizationView()
-call right in the component, it might be called several times due to re-rendering. In order to mitigate re-setting issues, it was important that theupdateResourceUtilizationView
function sets the corresponding values (setResourceUtilizationPercent
andsetResourceUtilizationTooltipText
) only once/when they actually change. To recognize such change, the helper-functionareReactElementsEqual
was implemented which compares React components. This adds a dependency toreact-dom/server
.The comparison helper-function, and therefore the dependency, can be removed by moving
updateResourceUtilizationView()
in auseEffect()
that is called only once (see here).