We prefer to avoid having useRef used for state management at Twenty, because we believe that state management should be left to state management libraries.
Actually we can put useRef wherever we want in the codebase.
Expected behavior
We want to prevent this with an ESLint rule that will force useRef to be typed with an HTML element only. Or any other idea if you find something that can tell we're using it only for manipulating a <div> or an <input> (and any other HTML component) in imperative ways.
That way we won't be able to use useRef as a state management solution.
The existing edge cases that can be found in the codebase should be ignored as we'll see how to refactor them later.
Scope & Context
We prefer to avoid having useRef used for state management at Twenty, because we believe that state management should be left to state management libraries.
You can see more in the documentation : https://docs.twenty.com/developer/frontend/best-practices#do-not-use-useref-to-store-state
Current behavior
Actually we can put useRef wherever we want in the codebase.
Expected behavior
We want to prevent this with an ESLint rule that will force useRef to be typed with an HTML element only. Or any other idea if you find something that can tell we're using it only for manipulating a
<div>
or an<input>
(and any other HTML component) in imperative ways.That way we won't be able to use useRef as a state management solution.
The existing edge cases that can be found in the codebase should be ignored as we'll see how to refactor them later.