-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Minor - P4
-
Affects Version/s: None
-
None
-
2
-
Iteration Regolith
-
Not Needed
-
Developer Tools
https://react.dev/reference/react/useRef#avoiding-recreating-the-ref-contents
const someRef = useRef(new Something());
This will re-create a new object on each render even though it's not used, only the initial value is used. Looks like we have a couple occurrences of this in Compass (and at the CompassWeb entrypoint. Can be a performance hit if the constructor or object creation is expensive or doing things.
This ticket involves updating those occurrences to follow the recommended pattern in the linked doc.
Maybe a lint for `useRef(new ...` that errors and links that page could be useful.