Exemplo de reagem de USeRefrence

import { useRef } from 'react';

function MyComponent() {
  const reference = useRef(initialValue);
  const someHandler = () => {
    // Access reference value:
    const value = reference.current;
    // Update reference value:
    reference.current = newValue;  };

  // ...
}
Inexpensive Impala