showing results for - "react userefrence example"
Alberto
02 Jan 2020
1import { useRef } from 'react';
2
3function MyComponent() {
4  const reference = useRef(initialValue);
5  const someHandler = () => {
6    // Access reference value:
7    const value = reference.current;
8    // Update reference value:
9    reference.current = newValue;  };
10
11  // ...
12}
similar questions
queries leading to this page
react userefrence example