how can useRef be used for storing previous state

后端 未结 0 1842
走了就别回头了
走了就别回头了 2021-01-12 22:51
function Counter() {
  const [count, setCount] = useState(0);

  const prevCountRef = useRef();
  useEffect(() => {
    prevCountRef.current = count;  });
  const         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题