Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tech Debt]: Refactor useState() to useRef() as relevant #2909

Open
emilydrakesmith opened this issue Aug 24, 2023 · 0 comments
Open

[Tech Debt]: Refactor useState() to useRef() as relevant #2909

emilydrakesmith opened this issue Aug 24, 2023 · 0 comments
Labels
low-prio technical debt This issue involves deferred engineering work

Comments

@emilydrakesmith
Copy link
Contributor

What is needed?

State values in React are generally held and memoized across renders by one of two hooks: useRef() and useState(). There exists one salient functional difference in use cases:

  • useState() will trigger a DOM refresh when its value changes (per React's differencing library)
  • useRef() will not trigger a DOM refresh when its value changes

There are a number of places in the app where a value is being memoized in a useState() hook but for one reason or another, do not need to trigger a DOM refresh. We should review all instances of useState() in the app and refactor to for useRef() where warranted. This will reduce unnecessary DOM refreshes and make the app more performant in general.

@emilydrakesmith emilydrakesmith added technical debt This issue involves deferred engineering work low-prio labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low-prio technical debt This issue involves deferred engineering work
Projects
None yet
Development

No branches or pull requests

1 participant