📜  反应用户参考示例 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:20.780000             🧑  作者: Mango

代码示例1
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;  };

  // ...
}