aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reactHelper.js
blob: e8a4135a3f36bcc30090eab176e295b25f7f2122 (plain)
1
2
3
4
5
6
7
8
9
10
import { useRef, useEffect } from 'react';

export const usePrevious = value => {
  const ref = useRef();
  useEffect(() => {
    ref.current = value;
  });
  return ref.current;
}