and-murray / wharf-spaces

MIT License
1 stars 0 forks source link

Resolve usage of `useSelector` #12

Open tomdownes14 opened 6 months ago

tomdownes14 commented 6 months ago

In GitLab by @tom.downes on Feb 28, 2024, 09:16

Summary

Our usage of useSelector, or in our case useAppSelector, uses the entire state object. This is non performant and highly discouraged.

A warning is generated in new versions of react-redux:

Selector unknown returned the root state when called. This can lead to unnecessary rerenders.
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.

Benefits

More performant usage of react-redux and no more warnings.

Possible Solution and Impacts

Are all areas of the checklist addressed?

tomdownes14 commented 6 months ago

In GitLab by @tom.downes on Feb 28, 2024, 14:28

created branch 334-resolve-usage-of-useselector to address this issue