📅  最后修改于: 2022-03-11 15:02:20.780000             🧑  作者: Mango
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; };
// ...
}