When you try to modify the element that was retrieved using querySelector, you're no longer taking the advantage of React virtual DOM. It's still possible to use querySelector in React, however, React encourages developers not to use it. Instead, we should aim to use refs if possible.
Refs provide a way to access DOM nodes or React elements created in the render method. (source: React)
TIP:
Using querySelector in React is not incorrect and it won't break your functionality. However, it is preferred to use an approach provided by the React framework. Mostly because it comes with certain benefits and optimizations.
Il faut qu'on remplace tout les appel au dom (getElementById/querySelector) par useRef() dans tout notre code
Il faut qu'on remplace tout les appel au dom (getElementById/querySelector) par useRef() dans tout notre code
https://stackoverflow.com/questions/59198952/using-document-queryselector-in-react-should-i-use-refs-instead-how