react-wrapper icon indicating copy to clipboard operation
react-wrapper copied to clipboard

Memoizing component 🚀

Open sanjaiyan-dev opened this issue 3 years ago • 1 comments

Memoizing the component for performance improvement :)

Sorry if I made any mistakes :(

sanjaiyan-dev avatar Aug 08 '22 16:08 sanjaiyan-dev

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 08 '22 16:08 google-cla[bot]

As soon as the maps-API is loaded, the Wrapper component is reduced to return <>{children}</>, in which case it won't benefit from memoization (here's a bit more explanation of this). Before the API is loaded it's either return <></>; or return render(status);, in the former case we wouldn't gain from memoization and in the latter case memoization could be added to the render-function if needed.

In any case, the Wrapper component itself will at most add a single Fragment to the VDOM and doesn't contribute to the DOM at all, so optimizations for the reconciler seem to be a bit misplaced here.

This is to say, I would prefer not to add this here unless someone can demonstrate a clear performance gain from memoizing this component.

usefulthink avatar Sep 13 '23 18:09 usefulthink